public async Task <ActionResult> Create(AddCatalogViewModel request) { if (!ModelState.IsValid) { Alert($"Invalid Request.", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(View()); } try { var catalogRequest = new AddCatalogRequest { Name = request.Name, Description = request.Description, EffectiveDate = request.EffectiveDate, EndDate = request.EndDate, EntityId = request.EntityId, Published = request.Published }; var result = await _catalogService.Create(catalogRequest); if (!result.Success) { Alert($"{result.Message}", NotificationType.info, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(View()); } Alert($"Catalog Created Successfully", NotificationType.success, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(RedirectToAction(nameof(Index))); } catch (Exception ex) { Alert($"Error! {ex.Message}.", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime)); return(View()); } }
public Catalog Create(Catalog catalog) { var retVal = _catalogService.Create(catalog); ClearCache(); return(retVal); }
public IHttpActionResult Create(webModel.Catalog catalog) { var newCatalog = _catalogService.Create(catalog.ToModuleModel()); var retVal = newCatalog.ToWebModel(); //Need for UI permission checks retVal.SecurityScopes = GetObjectPermissionScopeStrings(newCatalog); return(Ok(retVal)); }
public ActionResult Create(CatalogModel catalog) { if (ModelState.IsValid) { _service.Create(_mapper.Map <CatalogBL>(catalog)); return(RedirectToAction("Index")); } return(View()); }
public ActionResult Create(Dto.ProductCreate productCreate) { var validationResults = catalogService.Create(productCreate); if (validationResults.Count() > 0) { return(BadRequest(validationResults)); } return(Ok()); }
public async Task <IActionResult> Create(AlbumDTO album) { if (ModelState.IsValid) { await _catalogService.Create(album); return(RedirectToAction("Index")); } GetArtistsAndGenres(album); return(View(album)); }
public IHttpActionResult Create(webModel.Catalog catalog) { if ((_permissionService.UserHasAnyPermission(RequestContext.Principal.Identity.Name, PredefinedPermissions.CatalogsManage) && !catalog.Virtual) || (_permissionService.UserHasAnyPermission(RequestContext.Principal.Identity.Name, PredefinedPermissions.VirtualCatalogsManage) && catalog.Virtual)) { var retVal = _catalogService.Create(catalog.ToModuleModel()); return(Ok(retVal.ToWebModel())); } else { throw new UnauthorizedAccessException(); } }
private void UpdateCatalogs(ICollection <Catalog> original, ICollection <Catalog> backup) { var toUpdate = new List <Catalog>(); backup.CompareTo(original, EqualityComparer <Catalog> .Default, (state, x, y) => { switch (state) { case EntryState.Modified: toUpdate.Add(x); break; case EntryState.Added: _catalogService.Create(x); break; } }); _catalogService.Update(toUpdate.ToArray()); }
public async Task <IActionResult> Create([FromBody] CatalogItem catalogItem) { await _catalogService.Create(catalogItem); return(RedirectToAction(nameof(Index))); }
public IHttpActionResult Create(CatalogCreate catalog) { _catalogService.Create(catalog); return(Ok()); }