public IActionResult Create([FromBody] PaymentTypeRequest request) { try { if (string.IsNullOrWhiteSpace(request.Code)) { return(BadRequest("Invalid code")); } if (string.IsNullOrWhiteSpace(request.Description)) { return(BadRequest("Invalid description")); } var type = new PaymentType { Code = request.Code, Description = request.Description, CreateDate = DateTime.Now, UpdateDate = null, UserId = UserID }; _repository.Insert(type); var response = _mapper.Map <PaymentType, PaymentTypeResponse>(type); return(Ok(response)); } catch (Exception) { throw; } }
public ActionResult Create(PaymentType paymentType) { try { repository.Insert(paymentType); return(RedirectToAction("Index", "PaymentTypes")); } catch { return(View()); } }
public int Insert(PaymentType payment_type) { return(_repository.Insert(payment_type)); }