예제 #1
0
 public IActionResult Update(int id, MethodPayDTO methodPayDTO)
 {
     if (id <= 0 || id != methodPayDTO.Id)
     {
         return(BadRequest(new { message = "ID is invalid" }));
     }
     if (!_methodPayModel.UpdateDTO(id, methodPayDTO))
     {
         return(Problem(statusCode: 500, detail: "Can't update data"));
     }
     return(Ok());
 }
예제 #2
0
        public IActionResult Add(MethodPayDTO methodPayDTO)
        {
            if (methodPayDTO.Id != 0)
            {
                return(BadRequest(new { message = "Add method is invalid, field 'ID' not require" }));
            }
            var re = _methodPayModel.AddDTO(methodPayDTO);

            if (re == null)
            {
                return(Problem(statusCode: 500, detail: "Can't add data"));
            }
            return(Ok());
        }