public OperationResult modifyUserDefined(Guid userDefinedId, int index, UserDefinedAll userDefinedall) { var result = new OperationResult(); var singleitem = _repository.GetAll <UserDefinedProduct>().Where(x => x.UserDefinedId == userDefinedId).FirstOrDefault(x => x.Index == index); try { singleitem.RoomType = userDefinedall.RoomType; singleitem.Squarefeet = userDefinedall.Squarefeet; singleitem.ServiceItems = userDefinedall.ServiceItem; singleitem.Hour = countHour(userDefinedall.RoomType, userDefinedall.Squarefeet); singleitem.Price = Convert.ToDecimal(countHour(userDefinedall.RoomType, userDefinedall.Squarefeet)) * 500; singleitem.EditTime = DateTime.UtcNow.AddHours(8); singleitem.EditUser = singleitem.AccountName; _repository.Update <UserDefinedProduct>(singleitem); _context.SaveChanges(); result.IsSuccessful = true; } catch (Exception ex) { result.IsSuccessful = false; result.Exception = ex; } return(result); }
public JsonResult ModifyUserDefinedByUserDefindId(Guid userDefinedId, int index, UserDefinedAll userDefinedall) { if (ModelState.IsValid) { _productPageService.modifyUserDefined(userDefinedId, index, userDefinedall); return(Json(new { response = "success" }, JsonRequestBehavior.AllowGet)); } return(Json(new { response = "error" }, JsonRequestBehavior.AllowGet)); }