public async Task <BaseJsonResult> CreateNewPackage([FromBody] PackageUpdateViewModel viewModel) { var packageServiceModel = viewModel.ToPackageServiceModel(); packageServiceModel.User = CurrentUser; var newPackage = await _packageService.CreateNewPackage(packageServiceModel); return(new BaseJsonResult(Omi.Base.Properties.Resources.POST_SUCCEEDED, newPackage.Id)); }
public async Task <BaseJsonResult> UpdatePackage([FromBody] PackageUpdateViewModel model) { if (!ModelState.IsValid) { return(new ModelStateErrorJsonResult(ModelState.Values)); } var packageServiceModel = model.ToPackageServiceModel(); packageServiceModel.User = CurrentUser; await _packageService.UpdatePackageAsync(packageServiceModel); return(new BaseJsonResult(Omi.Base.Properties.Resources.POST_SUCCEEDED, model.Id)); }