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

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

            _lkpTourRepo.Add(tab);
            _lkpTourRepo.SaveChanges();
        }
示例#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())));
 }
示例#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;
     }
 }