コード例 #1
0
        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();
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        public async Task <IActionResult> Update([FromRoute] Guid id, [FromBody] UpsertCampusCommunityModel model)
        {
            await campusCommunityService.Update(id, model);

            return(NoContent());
        }
コード例 #4
0
        public async Task <IActionResult> Add([FromBody] UpsertCampusCommunityModel model)
        {
            var result = await campusCommunityService.Add(model);

            return(Created(result.Id.ToString(), null));
        }