public ActionResult Login(tblSkyVisionLogin model) { if (ModelState.IsValid) { using (CableApiAndroidEntity _db = new CableApiAndroidEntity()) { // string abc = ""; var result = _db.tblSkyVisionLogins.Where(psd => psd.UserId == model.UserId && psd.Password == model.Password).FirstOrDefault(); if (result != null) { FormsAuthentication.SetAuthCookie(model.UserId, model.RememberMe); Session["UserId"] = result.UserId; Session["Password"] = result.Password; return(RedirectToAction("Dashboard", "Admin")); } else { ModelState.AddModelError("", "Login data is incorrect!"); } } } return(View()); }
public async Task <ProjectResult> PaidBill(tblPaidBillModel model) { try { if (ModelState.IsValid) { // var result = _db.tblBills.Where(psd=>psd.CustId==model.CustId).FirstOrDefault(); using (CableApiAndroidEntity _db = new CableApiAndroidEntity()) { tblBill _objBill = (from psd in _db.tblBills.Where(psd => psd.Bid == model.Bid) select psd).FirstOrDefault(); tblCustomerRegistration _objCust = (from psd in _db.tblCustomerRegistrations.Where(psd => psd.CustId == _objBill.CustId) select psd).FirstOrDefault(); if (model.PaymentAmount2 != 0 && model.PaymentDate2 != "") { //_objBill.PaymentAmount1 = model.PaymentAmount1; //_objBill.PaymentDate1 = model.PaymentDate1; _objBill.PaymentAmount2 = model.PaymentAmount2; _objBill.PaymentDate2 = model.PaymentDate2; _objBill.Balance = model.Balance; _objBill.Bid = model.Bid; } else { _objBill.PaymentAmount1 = model.PaymentAmount1; _objBill.PaymentDate1 = model.PaymentDate1; _objBill.PaymentAmount2 = 0; _objBill.PaymentDate2 = ""; _objBill.Balance = model.Balance; _objBill.Bid = model.Bid; } if (model.PaymentAmount1 != 0 && model.PaymentAmount2 == 0) { //_objBill.Balance = (model.Monthcharge-model.PaymentAmount1); _objCust.OldBal = model.Balance; } else { //_objBill.Balance = (model.Monthcharge - (model.PaymentAmount2 + model.PaymentAmount1)); _objCust.OldBal = model.Balance; } _db.Entry(_objBill).State = System.Data.Entity.EntityState.Modified; _db.SaveChanges(); _db.Entry(_objCust).State = System.Data.Entity.EntityState.Modified; _db.SaveChanges(); return(new ProjectResult { Message = "Success", Status = 1, Response = _objBill }); } } else { return(new ProjectResult { Message = "Failed", Status = 0, Response = null }); } } catch (Exception exp) { return(new ProjectResult { Message = exp.ToString(), Status = 0, Response = null }); } }