Exemplo n.º 1
0
        public EntityCategory CreateEntityCategory(CreateEntityCategoryModel model,
                                                   FileDestinationMetadata metadata = null)
        {
            var entity = model.ToDest();

            PrepareCreate(entity);
            return(context.EntityCategory.Add(entity).Entity);
        }
        public IActionResult Create(CreateEntityCategoryModel model)
        {
            var validationResult = _service.ValidateCreateEntityCategory(User, model);

            if (!validationResult.Valid)
            {
                return(BadRequest(validationResult.Result));
            }
            var entity = _service.CreateEntityCategory(model);

            context.SaveChanges();
            return(Created($"/{ApiEndpoint.ENTITY_CATE_API}?id={entity.Id}",
                           new AppResultBuilder().Success(entity.Id)));
        }
Exemplo n.º 3
0
 public ValidationResult ValidateCreateEntityCategory(ClaimsPrincipal principal,
                                                      CreateEntityCategoryModel model)
 {
     return(ValidationResult.Pass());
 }