public async Task <Response <Hotel> > Update([FromBody] Hotel hotel) { //if (string.IsNullOrEmpty(hotel.Name)) //{ // return new Response<Hotel>() { Status = StatusEnum.ValidateModelError, Massage = "没有宾馆名称" }; //} //if (!Hander.CheckPassword(hotel)) //{ // return new Response<Hotel>() { Status = StatusEnum.ValidateModelError, Massage = "密码错误" }; //} //hotel.UpdateTime = DateTime.Now; //await Hander.Update(hotel, "Name", "Region", "Address", "UpdateTime","Remark"); KeyValuePair <bool, string> result = await Task.Run(() => { return(Hander.Update(hotel)); }); if (result.Key) { hotel.HotelPassword = null; return(new Response <Hotel>() { Status = StatusEnum.Success, Massage = "修改成功", Data = hotel }); } else { return(new Response <Hotel>() { Status = StatusEnum.ValidateModelError, Massage = result.Value }); } }
public async Task <BaseResponse> Update([FromBody] Guest guest) { string manager = HttpContext.User.Identity.Name; await Task.Run(() => { Hander.Update(guest, manager); }); return(new BaseResponse() { Status = StatusEnum.Success, Massage = "修改入住人成功" }); }
public async Task <BaseResponse> Delete([FromBody] Hotel hotel) { hotel.IsDel = true; hotel.UpdateTime = DateTime.Now; await Task.Run(() => { Hander.Update(hotel, "IsDel", "UpdateTime"); }); return(new BaseResponse() { Status = StatusEnum.Success, Massage = "删除成功" }); }