Пример #1
0
        public ActionResult Create([Bind(Include = "LedgerId,LedgerName")] LedgerMaster ledgerMaster)
        {
            if (ModelState.IsValid)
            {
                db.LedgerMasters.Add(ledgerMaster);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(ledgerMaster));
        }
Пример #2
0
 public ActionResult Register(RegisterSchoolModel obj, [Bind(Include = "user_name,user_role,school_code,approve_status,PhoneNo,isActive")] tb_login log)
 {
     if (ModelState.IsValid)
     {
         string uname = log.user_name;
         string code  = log.school_code;
         //var count = db.tb_login.Single(u => u.user_name == uname && u.school_code == code);
         int count = db.tb_login.Count(u => u.user_name == uname && u.school_code == code);
         if (count == 0)
         {
             db.tb_login.Add(log);
             db.SaveChanges();
             ModelState.Clear();
             TempData["Success"] = "Registration Request Sent!";
         }
         else
         {
             TempData["Count"] = "Already Registered!";
         }
         return(View("Index", new RegisterSchoolModel()));
     }
     return(View("Index", new RegisterSchoolModel()));
 }