public IHttpActionResult UpdateStatus(AreaUpdateViewModel model) { try { var areaApi = new AreaApi(); var result = areaApi.UpdateStatus(model); if (result) { return(Json(new ResultModel { message = "Cập nhập thành công", success = true, })); } else { return(Json(new ResultModel { message = "Có chỗ đậu đang sử dụng, vui lòng cập nhật sau", success = false, })); } } catch (Exception ex) { return(Json(new ResultModel { message = "Có lỗi xảy ra, vui lòng liên hệ admin", success = false, })); } }
/// <summary> /// 更新小区信息 /// </summary> /// <param name="areaUpdateViewModel"></param> /// <returns></returns> public int Area_Update(AreaUpdateViewModel areaUpdateViewModel) { var areaUpdateModel = _IMapper.Map <AreaUpdateViewModel, ResidentialArea>(areaUpdateViewModel); _residentialAreaRepository.Update(areaUpdateModel); return(_residentialAreaRepository.SaveChanges()); }
public ActionResult <AreaUpdateResViewModel> Manage_OpinionInfo_Update(AreaUpdateViewModel areaUpdateViewModel) { int Area_Update_Count; Area_Update_Count = _residentialAreaService.Area_Update(areaUpdateViewModel); var opinionInfoUpdateResModel = _areaFactory.GetAreaUpdateResponseViewModel(); if (Area_Update_Count > 0) { opinionInfoUpdateResModel.baseViewModel.IsSuccess = true; opinionInfoUpdateResModel.AddCount = Area_Update_Count; opinionInfoUpdateResModel.baseViewModel.Message = "更改成功"; opinionInfoUpdateResModel.baseViewModel.ResponseCode = 200; _ILogger.Information("更改小区信息成功"); return(Ok(opinionInfoUpdateResModel)); } else { opinionInfoUpdateResModel.baseViewModel.IsSuccess = false; opinionInfoUpdateResModel.AddCount = 0; opinionInfoUpdateResModel.baseViewModel.Message = "更改失败"; opinionInfoUpdateResModel.baseViewModel.ResponseCode = 400; _ILogger.Information("更改小区信息失败"); return(BadRequest(opinionInfoUpdateResModel)); } }
public void UpdateName(AreaUpdateViewModel model) { var entity = this.BaseService.Get(model.Id); if (entity != null) { entity.Name = model.Name; this.BaseService.Update(entity); } }
public IHttpActionResult UpdateName(AreaUpdateViewModel model) { try { var areaApi = new AreaApi(); areaApi.UpdateName(model); return(Json(new { success = true, })); } catch (Exception ex) { return(Json(new { success = false, })); } }
public bool UpdateStatus(AreaUpdateViewModel model) { var entity = this.BaseService.Get(model.Id); if (entity != null) { var parkingLotApi = new ParkingLotApi(); if (entity.ParkingLots.Count(a => a.Status == (int)ParkingLotStatus.Active || a.Status == (int)ParkingLotStatus.Deactive) < entity.ParkingLots.Count()) { return(false); } else { entity.Status = model.Status; parkingLotApi.UpdateStatus(entity.ParkingLots, model.Status); return(true); } } else { return(false); } }