Exemplo n.º 1
0
        public async Task <object> AddCoordinator([FromBody] CoordinatorClassViewModel model)
        {
            CoordinatorClass item = new SimpleAutoMapper <CoordinatorClass>().Map(model);

            try
            {
                if (await CheckPermissionToAddCoordinator(item))
                {
                    Response response = await _classService.AddCoordinator(new Class()
                    {
                        ID = item.ClassID
                    }, new Coordinator()
                    {
                        ID = item.CoordinatorID
                    });

                    return(response);
                }

                return(Forbid());
            }
            catch (Exception e)
            {
                Response.StatusCode = StatusCode(500).StatusCode;
                return(null);
            }
        }