public int AddSupplier(SupplierDTO dto) { int id = 0; try { log.Debug(SupplierDTO.FormatSupplierDTO(dto)); R_Supplier t = SupplierDTO.ConvertDTOtoEntity(dto); // add id = Repository.AddSupplier(t); dto.SupplierId = id; log.Debug("result: 'success', id: " + id); } catch (System.Exception e) { // error log.Error(e.ToString()); throw; } return(id); }
public int AddSupplier(string name, string email) { ISupplier supplier = factory.CreateSupplier(name, email); int id = supplierRepository.AddSupplier(supplier); Debug.WriteLine("Supplier with ID " + id + " added to repo from facade"); return(id); }
//https://localhost:44384/api/suppliers/supcode public IActionResult AddSupplier([FromBody] SupplierDTO supplierDTO) { var supplier = _mapper.Map <Supplier>(supplierDTO); _supplierRepo.AddSupplier(supplier); return(Created(HttpContext.Request.Scheme + "://" + HttpContext.Request.Host + HttpContext.Request.Path + "/" + supplierDTO.Supcode, supplierDTO)); }
protected override async Task <Unit> HandleValidatedCommand(AddSupplierCommand command) { await _repository.AddSupplier( id : command.Id, name : command.Name, contactInfo : command.ContactInfo); return(Unit.Value); }
public int AddSupplier(SupplierDetailsVM newSupplierVM, string userId) { Supplier supplier = new Supplier(); supplierMapping.MapSupplierEntityFromVM(newSupplierVM, supplier); var sMapped = _supplierRepository.AddSupplier(supplier, userId); return(sMapped); }
public async Task <Supplier> AddSupplier(Supplier supplier) { try { return(await _supplierRepository.AddSupplier(supplier)); } catch (Exception exception) { throw exception; } }
public int AddSupplier(string name, string email) { ISupplier supplier = factory.CreateSupplier(name, email); int id = supplierRepository.AddSupplier(supplier); Debug.WriteLine("Supplier with ID " + id + " added to repo from facade"); string content = "Congratulations on becoming our supplier!"; mailSender.SendMail(supplier.Email, content); return(id); }
public IHttpActionResult PostSUPPLIER(SupplierModel supplier) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } string suplNo = _supplierRepository.AddSupplier(supplier); return(CreatedAtRoute("DefaultApi", new { id = suplNo }, supplier)); }
public IActionResult AddSupplier(SupplierViewModel viewModel) { if (ModelState.IsValid) { SuppliersModel model = new SuppliersModel(); model.Name = viewModel.Name; model.Email = viewModel.Email; model.PhoneNumber = viewModel.PhoneNumber; _supplierRepository.AddSupplier(model); return(RedirectToAction("SuppliersDisplay")); } return(View()); }
public IActionResult PostSupplier([FromBody] SupplierWithoutProductsDto supplier, int accountId = -1) { if (supplier is null) { return(BadRequest()); } if (!_arepo.AuthorizeUser(accountId, Permission.AddSupplier)) { return(Unauthorized()); } var(isValid, errors) = supplier.Validate(); if (!isValid) { return(BadRequest(errors)); } var supToAdd = Mapper.Map <Supplier>(supplier); return(_repo.AddSupplier(supToAdd) ? new StatusCodeResult(StatusCodes.Status201Created) : new StatusCodeResult(StatusCodes.Status500InternalServerError)); }
public HttpResponseMessage Post([FromBody] Models.supplier supplier) { try { if (string.IsNullOrEmpty(supplier.supplier_name)) { var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "error", msg = "Supplier Name is Empty" }, formatter)); } if (supplierRepository.CheckDuplicateSupplier(supplier.supplier_name)) { var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "error", msg = "Supplier Already Exists" }, formatter)); } if (string.IsNullOrEmpty(supplier.supplier_type_id.ToString())) { var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "error", msg = "Supplier Type is Empty" }, formatter)); } if (string.IsNullOrEmpty(supplier.mobile)) { var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "error", msg = "Mobile is Empty" }, formatter)); } if (string.IsNullOrEmpty(supplier.contact_person)) { var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "error", msg = "Contact Person is Empty" }, formatter)); } if (string.IsNullOrEmpty(supplier.email)) { var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "error", msg = "Email 1 is Empty" }, formatter)); } if (string.IsNullOrEmpty(supplier.receiving_company_person)) { var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "error", msg = "Contact Person is Empty" }, formatter)); } if (string.IsNullOrEmpty(supplier.receiving_company_contact_email)) { var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "error", msg = "Email is Empty" }, formatter)); } else { supplier insertSupplier = new supplier { supplier_name = supplier.supplier_name, supplier_code = supplier.supplier_code, supplier_type_id = supplier.supplier_type_id, company_address = supplier.company_address, factory_address = supplier.factory_address, phone = supplier.phone, mobile = supplier.mobile, email = supplier.email, email2 = supplier.email2, contact_person = supplier.contact_person, contact_person2 = supplier.contact_person2, total_debit = 0, total_credit = 0, balance = 0, is_active = supplier.is_active = true, created_by = supplier.created_by, vat_id = supplier.vat_id, tin_no = supplier.tin_no, receiving_company_name = supplier.receiving_company_name, receiving_company_person = supplier.receiving_company_person, receiving_company_contact_email = supplier.receiving_company_contact_email }; /* Supplier table entry by kiorn*/ supplierRepository.AddSupplier(insertSupplier); /* Supplier table entry by kiorn*/ var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "success", msg = "Supplier save successfully" }, formatter)); } } catch (Exception ex) { var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "error", msg = ex.ToString() }, formatter)); } }
public IHttpActionResult Post(Supplier supplier) { var result = _supplierRepository.AddSupplier(supplier); return(Json(result)); }
public ActionResult AddSupplier([FromBody] Supplier supplier) { int id = _supplierRepository.AddSupplier(supplier); return(Ok(id)); }
public void AddSupplier(Supplier supplier) { _supplierRepository.AddSupplier(supplier); }
public ResModel AddSupplier(SupplierDto supplierDto, UserDto operationUser) { return(_supplierRepository.AddSupplier(supplierDto, operationUser)); }
/// <summary> /// Add Supplier /// </summary> /// <param name="supplier"></param> /// <returns></returns> Supplier ISupplierService.AddSupplier(Supplier supplier) { return(_repository.AddSupplier(supplier)); }