public override JsonResult Update(FormValues <TFormDetailViewModel> formValues) { var entityDetails = FormUtitities.ViewModelToEntityDetails <TEntityDetail>(formValues.Details, formValues.Language); var result = _entityController.Update(long.Parse(formValues.Meta["id"]), entityDetails.ToArray(), formValues.GetTaxonomuTypeIdTaxonomyId(), _userManager.FindByNameAsync(User.Identity.Name).Result); return(Json( result > 0 ? new BaseAjaxResult(JsonResultState.Success, "Update successuly") : new BaseAjaxResult(JsonResultState.Failed, "Update failed"))); }
public async Task <JsonResult> Update(FormValues <ImageViewModel> formValues) { var user = await _userManager.FindByNameAsync(User.Identity.Name); var fileId = long.Parse(formValues.GetMetaValue("id")); Dictionary <long, long[]> taxonomyTypeTaxonomies = formValues.TaxonomyTypes?.ToDictionary(o => o.Key, o => o.Value.Keys.ToArray()); var entityDetails = FormUtitities.ViewModelToEntityDetails <FileEntityDetail>(formValues.Details, formValues.Language); var result = _mediaHelper.Update(fileId, entityDetails, taxonomyTypeTaxonomies, user); return(Json(result)); }
public virtual JsonResult Create(FormValues <TFormDetailViewModel> formValues) { var entityDetails = FormUtitities.ViewModelToEntityDetails <TEntityDetail>(formValues.Details, formValues.Language); var entity = new TEntity { Name = formValues.Details.Title, }; entity = _entityController.Create(entity, entityDetails.ToArray(), _userManager.FindByNameAsync(User.Identity.Name).Result); return(Json(new BaseAjaxResult(JsonResultState.Success, _entityController.GetLocalizationString("Create successfuly."), Url.Action("update", new { id = entity.Id })))); }