Пример #1
0
        public async Task <ActionResult> Create(CampusViewModel campusViewModel)
        {
            var existingCampus = await _campusService.FindByCode(campusViewModel.Code);


            if (existingCampus == null)
            {
                var campus = new Campus
                {
                    Name = campusViewModel.Name,
                    Code = campusViewModel.Code
                };
                await _campusService.Create(campus);

                return(Ok());
            }
            else
            {
                return(BadRequest("Ya existe un campus con este codigo"));
            }
        }