public async Task <object> PutUpdate(int id, [FromBody] CooperationViewModel model) { MessageBase2 result = new MessageBase2(); CooperationDto dto = ConvertHelper.ChangeType <CooperationDto>(model); await _cooperationService.UpdateAsync(id, dto); return(result); }
/// <summary> /// 添加数据 /// </summary> /// <param name="dto"></param> /// <returns></returns> public async Task <bool> AddAsync(CooperationDto dto) { var model = ConvertHelper.ChangeType <Cooperation>(dto); model.ReleaseTime = DateTime.Now; model.Status = 1; model.Cont = dto.Describe; model = await this.CooperationRepository.AddAsync(model); return(model.Id > 0); }
/// <summary> /// 修改兑换 /// </summary> /// <param name="id">兑换id</param> /// <param name="dto"></param> /// <returns></returns> public async Task <bool> UpdateAsync(int id, CooperationDto dto) { var model = await this.CooperationRepository.FindAsync(ex => ex.Id == id); model.EnrollEnd = dto.EnrollEnd.ToString(); model.Will = dto.Will; model.Cover = dto.Cover; model.Cont = dto.Describe; model.ImgList = dto.ImgList; model.Prov = dto.Prov; model.City = dto.City; model.Dist = dto.Dist; model.Address = dto.Address; model.Title = dto.Title; model.LimitPerson = dto.LimitPerson; model.ClassId = dto.ClassId; return(await this.CooperationRepository.UpdateAsync(model)); }