The if condition is not accepting in asp.net mvc razor

0

I want to do an update with a condition, however, it is updating the data without seeing the condition of if

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using BlogWeb.ViewsModels;
using BlogWeb.DAO;
using BlogWeb.Models;
using BlogWeb.Filters;
using BlogWeb.Controllers;
using NHibernate;
using BlogWeb.Infra;

namespace BlogWeb.Controllers
{
    public class GerenciamentoKM
    {
        private Rota p;
        private ISession session;
        public GerenciamentoKM(ISession session, Rota p)
        {
            this.p = p;
            this.session = session;
        }
        public void soma (Rota post)
        {
                using (ISession session = NHibernateHelper.AbreSession())
                {
                    if (p.Km_Atual <= p.Km_Anterior)
                    {
                        ITransaction tx = session.BeginTransaction();
                        session.Update(post);
                        tx.Commit();
                    }
                 }
         }
    }
}
    
asked by anonymous 26.05.2017 / 16:31

0 answers