public ActionResult EditForEmergencyTreatmentAllergies(int id)
        {
            EmergencyTreatmentAllergiesModel    model = new EmergencyTreatmentAllergiesModel();
            EmergencyTreatmentAllergiesProvider ep    = new EmergencyTreatmentAllergiesProvider();

            //model = ep.GetListForEmergencyTreatmentAllergies().Where(x => x.EmergencyMasterId == id).FirstOrDefault();
            model = ep.GetListForEmergencyTreatmentAllergies().Where(x => x.TreatmentAllergiesId == id).FirstOrDefault();
            return(PartialView("_EditForEmergencyTreatmentAllergies", model));
        }
        public int UpdateForEmergencyTreatmentAllergies(EmergencyTreatmentAllergiesModel model)
        {
            int i = 0;

            using (EHMSEntities ent = new EHMSEntities())
            {
                var objToEdit = ent.EmergencyTreatmentAllergies.Where(x => x.TreatmentAllergiesId == model.TreatmentAllergiesId).FirstOrDefault();
                model.CreatedBy   = 1;
                model.Status      = 1;
                model.CreatedDate = DateTime.Now;
                AutoMapper.Mapper.Map(model, objToEdit);
                ent.Entry(objToEdit).State = System.Data.EntityState.Modified;
                i = ent.SaveChanges();
            }
            return(i);
        }
        public ActionResult EditForEmergencyTreatmentAllergies(EmergencyTreatmentAllergiesModel modell)
        {
            EmergencyTreatmentAllergiesProvider ep = new EmergencyTreatmentAllergiesProvider();
            var staffname = modell.Staff;

            if (string.IsNullOrWhiteSpace(staffname) == false)
            {
                // string str = Regex.Replace(ipValue, "[^0-9]+", string.Empty);
                string Valuenew  = staffname.Trim();
                int    BracIndex = staffname.IndexOf('{') + 1;
                int    TotalLen  = staffname.IndexOf('}') - 1;
                int    Len       = staffname.Length;
                int    toval     = Len - BracIndex;
                string value     = staffname.Substring(BracIndex, toval - 1);
                int    aa        = value.IndexOf('^') + 1;
                int    bb        = value.Length;
                int    lenth     = bb - aa;
                string id        = value.Substring(aa, lenth);
                modell.Staff = id;
            }

            int i = ep.UpdateForEmergencyTreatmentAllergies(modell);

            if (i != null)
            {
                modell.ListEmergencyTreatmentAllergiesModel = ep.GetSelectedData(modell.EmergencyMasterId);

                EmergecyMasterModel model = new EmergecyMasterModel();
                model.ListEmergencyTreatmentAllergiesModel = modell.ListEmergencyTreatmentAllergiesModel;

                TempData["success"] = HospitalManagementSystem.UtilityMessage.edit;
                return(PartialView("_IndexForEmergencyTreatmentAllergies", model));
            }
            else
            {
                modell.ListEmergencyTreatmentAllergiesModel = ep.GetSelectedData(modell.EmergencyMasterId);

                EmergecyMasterModel model = new EmergecyMasterModel();
                model.ListEmergencyTreatmentAllergiesModel = modell.ListEmergencyTreatmentAllergiesModel;
                TempData["success"] = HospitalManagementSystem.UtilityMessage.editfailed;
                return(PartialView("_IndexForEmergencyTreatmentAllergies", model));
            }
        }