Exemplo n.º 1
0
        public void Update(int id, LkpTourVw obj)
        {
            var tab = _mapper.Map <LkpTour>(obj);

            _lkpTourRepo.Update(id, tab);
            _lkpTourRepo.SaveChanges();
        }
Exemplo n.º 2
0
        public void Insert(LkpTourVw obj)
        {
            var tab = _mapper.Map <LkpTour>(obj);

            _lkpTourRepo.Add(tab);
            _lkpTourRepo.SaveChanges();
        }
Exemplo n.º 3
0
 public async Task <IActionResult> Post(LkpTourVw obj)
 {
     if (!ModelState.IsValid)
     {
         Response.StatusCode = 400;
         return(Ok(new Res(false, "State not valid", obj)));
     }
     _lkpTourService.Insert(obj);
     return(Ok(new Res(true, "Complite", await _lkpTourService.GetAll())));
 }
Exemplo n.º 4
0
 public async Task <IActionResult> Put(int id, LkpTourVw obj)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             Response.StatusCode = 400;
             return(Ok(new Res(false, "State not valid", obj)));
         }
         _lkpTourService.Update(id, obj);
         return(Ok(new Res(true, "Complite", await _lkpTourService.GetAll())));
     }
     catch (Exception e)
     {
         // Console.WriteLine(e);
         // return not
         // Response.StatusCode = 400;
         //  return Ok(new Res(false, "State not valid", obj));
         throw e;
     }
 }