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(); }
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()))); }
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; } }