public ActionResult AddPrice(string json) { if (Session["auth_info"] != null) { try { var authInfo = (AuthInfo)Session["auth_info"]; IList <PriceModel> listPrice; listPrice = JsonConvert.DeserializeObject <IList <PriceModel> >(json); //foreach (var item in listPrice) // if (string.IsNullOrEmpty(item.Id)) // listPrice.Remove(item); var model = new EditPriceModel(); model.HospitalId = authInfo.CurrentSelectedClinic.ClinicId; model.Prices = listPrice; _priceService.AddPrice(null, model); TempData[GlobalConstant.ErrorTemp] = "List prices successfully updated."; return(Json(new { success = "true" }, JsonRequestBehavior.AllowGet)); } catch (ApiException ex) { TempData[GlobalConstant.ErrorTemp] = ex.Message; return(Json(new { success = "false" }, JsonRequestBehavior.AllowGet)); } } else { TempData[GlobalConstant.ErrorTemp] = GlobalConstant.SessionExpiredOrNotLogin; return(RedirectToAction("Index", "Home")); } }