private JsonResult EditData(PriceViewModel model) { var entity = _service.GetByKey(model.ProductPrice.Id); if (!Convert.ToBase64String(model.ProductPrice.Timestamp).Equals(Convert.ToBase64String(entity.Timestamp))) { return(Json(new { result = Constants.DataJustChanged })); } try { if (!string.IsNullOrEmpty(model.dStartTemp)) { entity.dStart = DateTime.ParseExact(model.dStartTemp, "MM/dd/yyyy", new CultureInfo(Constants.MyCultureInfo)); } if (!string.IsNullOrEmpty(model.dEndTemp)) { entity.dEnd = DateTime.ParseExact(model.dEndTemp, "MM/dd/yyyy", new CultureInfo(Constants.MyCultureInfo)); } entity.Price = model.ProductPrice.Price; entity.CurrencyId = model.ProductPrice.CurrencyId; entity.SupplierId = model.ProductPrice.SupplierId; entity.StoreId = model.ProductPrice.StoreId; entity.iModified = model.LoginId; entity.dModified = DateTime.Now; entity.Status = SetStatus(entity.dStart, entity.dEnd); this._service.Update(entity); return(Json(new { result = Constants.Success })); } catch (Exception e) { Log.Error("Update Price!", e); return(Json(new { result = Constants.UnSuccess })); } }