示例#1
0
        public ActionResult Edit(int id)
        {
            EmergencyPoliceCaseProvider EPCPro = new EmergencyPoliceCaseProvider();
            EmergencyPoliceCaseModel    model  = new EmergencyPoliceCaseModel();

            model = EPCPro.GetList().Where(x => x.PCId == id).FirstOrDefault();
            return(View(model));
        }
示例#2
0
        //
        // GET: /EmergencyPoliceCase/

        //public ActionResult Index()
        //{
        //    return View();
        //}
        public ActionResult Index()
        {
            EmergencyPoliceCaseProvider EPCPro = new EmergencyPoliceCaseProvider();
            EmergencyPoliceCaseModel    model  = new EmergencyPoliceCaseModel();

            model.EmergencyPoliceCaseModelList = EPCPro.GetList();
            return(View(model));
        }
        public int Insert(EmergencyPoliceCaseModel model)
        {
            int i = 0;

            using (EHMSEntities ent = new EHMSEntities())
            {
                var objToSave = AutoMapper.Mapper.Map <EmergencyPoliceCaseModel, EmergencyPoliceCase>(model);
                objToSave.CreatedDate = DateTime.Now;
                objToSave.CreatedBy   = 1;
                objToSave.Status      = "Y";
                ent.EmergencyPoliceCases.Add(objToSave);
                i = ent.SaveChanges();
            }
            return(i);
        }
        public int Update(EmergencyPoliceCaseModel model)
        {
            int i = 0;

            using (EHMSEntities ent = new EHMSEntities())
            {
                var objToEdit = ent.EmergencyPoliceCases.Where(x => x.PCId == model.PCId).FirstOrDefault();
                AutoMapper.Mapper.Map(model, objToEdit);
                objToEdit.CreatedDate = DateTime.Now;
                objToEdit.CreatedBy   = 1;
                objToEdit.Status      = "Y";

                ent.Entry(objToEdit).State = System.Data.EntityState.Modified;
                i = ent.SaveChanges();
            }
            return(i);
        }
示例#5
0
 public ActionResult Edit(int id, EmergencyPoliceCaseModel model)
 {
     if (ModelState.IsValid)
     {
         EmergencyPoliceCaseProvider EPCPro = new EmergencyPoliceCaseProvider();
         int i = EPCPro.Update(model);
         if (i != null)
         {
             TempData["success"] = HospitalManagementSystem.UtilityMessage.edit;
             return(RedirectToAction("Index"));
         }
         else
         {
             TempData["success"] = HospitalManagementSystem.UtilityMessage.editfailed;
             return(RedirectToAction("Index"));
         }
         //return View(model);
     }
     return(View(model));
 }
示例#6
0
        public ActionResult Create(EmergencyPoliceCaseModel model)
        {
            EmergencyPoliceCaseProvider EPCPro = new EmergencyPoliceCaseProvider();

            if (ModelState.IsValid)
            {
                EHMSEntities ent = new EHMSEntities();
                //var data = ent.EmergencyPoliceCase.Where(m => m == model.BlockName).Select(m => m.BlockId).ToList();
                //if (data.Count == 0)
                //{
                int i = EPCPro.Insert(model);
                return(RedirectToAction("Index"));
                //    if (i != null)
                //    {

                //        TempData["success"] = Hospital.UtilityMessage.save;
                //        return RedirectToAction("Index");
                //    }
                //    else
                //    {
                //        TempData["success"] = Hospital.UtilityMessage.savefailed;
                //        return RedirectToAction("Index");

                //    }
                //}
                //else
                //{
                //    TempData["success"] = "Block Name Already Exist !";
                //    return RedirectToAction("Index");

                //}
            }


            return(View());
        }
示例#7
0
        public ActionResult Create()
        {
            EmergencyPoliceCaseModel model = new EmergencyPoliceCaseModel();

            return(View(model));
        }