public ProductModel CreateProductModel(CreateProductModelModel model) { var entity = model.ToDest(); PrepareCreate(entity); return(context.ProductModel.Add(entity).Entity); }
public IActionResult Create(CreateProductModelModel model) { var validationData = _service.ValidateCreateProductModel(User, model); if (!validationData.IsValid) { return(BadRequest(AppResult.FailValidation(data: validationData))); } var entity = _service.CreateProductModel(model); context.SaveChanges(); // must be in transaction var ev = _ev_service.CreateProductModel(entity, User); context.SaveChanges(); return(Created($"/{Business.Constants.ApiEndpoint.RESOURCE_API}?id={entity.Id}", AppResult.Success(entity.Id))); }
public ValidationData ValidateCreateProductModel(ClaimsPrincipal principal, CreateProductModelModel model) { return(new ValidationData()); }