Example #1
0
 public ActionResult Create(DeductionSetupModel model)
 {
     if (ModelState.IsValid)
     {
         pro.Insert(model);
         TempData["success"] = "Record Created Successfully !";
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View(model));
     }
 }
Example #2
0
 public int Update(DeductionSetupModel model)
 {
     using (EHMSEntities ent = new EHMSEntities())
     {
         var objToEdit = ent.DeductionSetups.Where(x => x.ID == model.ID).FirstOrDefault();
         model.CreatedBy     = objToEdit.CreatedBy;
         model.Status        = true;
         model.DeductionName = HospitalManagementSystem.Utility.GetAccountHeadName(model.AccountHeadID);
         model.CreatedDate   = objToEdit.CreatedDate;
         AutoMapper.Mapper.Map(model, objToEdit);
         ent.Entry(objToEdit).State = System.Data.EntityState.Modified;
         ent.SaveChanges();
     }
     return(1);
 }
Example #3
0
        public int Insert(DeductionSetupModel model)
        {
            EHMSEntities ent    = new EHMSEntities();
            var          Tosave = AutoMapper.Mapper.Map <DeductionSetupModel, DeductionSetup>(model);

            Tosave.CreatedBy     = 1;
            Tosave.CreatedDate   = DateTime.Now;
            Tosave.Status        = true;
            Tosave.DeductionName = HospitalManagementSystem.Utility.GetAccountHeadName(model.AccountHeadID);
            Tosave.BranchId      = 1;
            ent.DeductionSetups.Add(Tosave);
            ent.SaveChanges();


            return(1);
        }
Example #4
0
 public ActionResult Edit(DeductionSetupModel model)
 {
     pro.Update(model);
     TempData["success"] = "Record Updated Successfully !";
     return(RedirectToAction("Index"));
 }
Example #5
0
 public ActionResult Edit(int id)
 {
     model = pro.GetAll().Where(m => m.ID == id).FirstOrDefault();
     return(View(model));
 }