public virtual ActionResult Modify(CommodityModel model) { if (model == null) { return(null); } var dataImages = GetCommodityImages(model.Id.Convert <long>()); var dataTags = GetCommodityTags(model.Id.Convert <long>()); var entity = model.CreateEntity(SaveType.Modify, dataImages, dataTags); var result = new Dictionary <string, object>(); var rev = this.SaveEntity(entity); var mess = rev ? "" : entity.Errors?.FirstOrDefault()?.Message; result.Add("Status", rev); result.Add("Message", mess); return(this.Jsonp(result)); }
public virtual ActionResult Add(CommodityModel model) { if (model == null) { return(null); } var entity = model.CreateEntity(SaveType.Add, null, null); entity.Sequence = GetSequence(); var result = new Dictionary <string, object>(); entity.Site = new SiteEntity { Id = SiteId }; var rev = this.SaveEntity(entity); var mess = rev ? "" : entity.Errors?.FirstOrDefault()?.Message; result.Add("Status", rev); result.Add("Id", entity.Id); result.Add("Sequence", entity.Sequence); result.Add("Message", mess); return(this.Jsonp(result)); }