Beispiel #1
0
        public ProductionLine CreateProductionLine(CreateProductionLineModel model)
        {
            var entity = model.ToDest();

            PrepareCreate(entity);
            return(context.ProductionLine.Add(entity).Entity);
        }
        public IActionResult Create(CreateProductionLineModel model)
        {
            var validationData = _service.ValidateCreateProductionLine(User, model);

            if (!validationData.IsValid)
            {
                return(BadRequest(AppResult.FailValidation(data: validationData)));
            }
            var entity = _service.CreateProductionLine(model);

            context.SaveChanges();
            // must be in transaction
            var ev = _ev_service.CreateProductionLine(entity, User);

            context.SaveChanges();
            return(Created($"/{Business.Constants.ApiEndpoint.PRODUCTION_LINE_API}?id={entity.Id}",
                           AppResult.Success(entity.Id)));
        }
Beispiel #3
0
 public ValidationData ValidateCreateProductionLine(ClaimsPrincipal principal,
                                                    CreateProductionLineModel model)
 {
     return(new ValidationData());
 }