public async Task Update(Guid id, UpsertCampusCommunityModel model) { var campusCommunity = await repository.GetById(id); campusCommunity.Update(model.Name, model.Description, model.Image, model.Link, model.StudentsNumber, model.IdUser); repository.Update(campusCommunity); await repository.SaveChanges(); }
public async Task <CampusCommunityModel> Add(UpsertCampusCommunityModel model) { var campusCommunity = new CampusCommunity(model.Name, model.Description, model.Image, model.Link, model.StudentsNumber, model.IdUser); await repository.Add(campusCommunity); await repository.SaveChanges(); return(mapper.Map <CampusCommunityModel>(campusCommunity)); }
public async Task <IActionResult> Update([FromRoute] Guid id, [FromBody] UpsertCampusCommunityModel model) { await campusCommunityService.Update(id, model); return(NoContent()); }
public async Task <IActionResult> Add([FromBody] UpsertCampusCommunityModel model) { var result = await campusCommunityService.Add(model); return(Created(result.Id.ToString(), null)); }