Пример #1
0
 public static LunchDetailed DaltoDetailedApi(this DalSchool.Lunch l)
 {
     return(new LunchDetailed()
     {
         Id = l.Id,
         Name = l.Name,
         Description = l.Description,
         Date = l.Date
     });
 }
Пример #2
0
 public static Lunch DaltoSimplifiedApi(this DalSchool.Lunch l)
 {
     return(new Lunch()
     {
         Id = l.Id,
         Name = l.Name,
         Description = l.Description,
         Date = l.Date
     });
 }
        [HttpPut] /*POSTMAN OK*/
        public IActionResult Update([FromBody] D.Lunch entity)
        {
            switch (_lunchRepo.Update(entity))
            {
            case (DBErrors.Success):
                return(Ok());

            case (DBErrors.NullExeption):
                return(Problem("A mandatory field does not support 'null' value or is missing", statusCode: (int)HttpStatusCode.BadRequest));

            default:
                return(Problem("?", statusCode: (int)HttpStatusCode.NotFound));
            }
        }