예제 #1
0
        public async Task <object> Add(Supplier supplier)
        {
            bool isValid = await _supplierService.AddSupplier(supplier);

            _notification.SetNotificationMessage(isValid, Title, supplier.UID);

            return(_notification);
        }
예제 #2
0
        public IHttpActionResult Add([FromBody] SupplierView supplier)
        {
            var supplierDTO = mapper.Map <SupplierView, SupplierDTO>(supplier);

            suppliersService.AddSupplier(supplierDTO);

            suppliersService.SaveChanges();

            return(Ok());
        }
예제 #3
0
        public ItemResult <object> CreateSupplier(SupplierRequest supplierRequest)
        {
            var result = ItemResult <object> .SuccessResult;

            try
            {
                result.data = _suppliersService.AddSupplier(SupplierRequest2Entity(supplierRequest));
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public HttpResponseMessage AddSupplier([FromBody] SupplierDto supplier)
 {
     _service.AddSupplier(supplier);
     _service.ApplyChanges();
     return(Request.CreateResponse(HttpStatusCode.OK, $"Suppliers added {supplier.Name}"));
 }
예제 #5
0
 /// <summary>
 /// Додає постачальника
 /// </summary>
 /// <param name="supplierDto">Екземпляр постачальника</param>
 public void AddSupplier(SuppliersDtoModel supplierDto) => suppliersService.AddSupplier(supplierDto);