Esempio n. 1
0
        public ActionResult Assign(Assignment model)
        {
            if (!Request.IsAuthorized())
            {
                return(Unauthorized());
            }
            if (!Films.Exists(model.FilmId))
            {
                return(NotFound($"Film with {model.FilmId} not found"));
            }
            if (!Films.Exists(model.EmployeeId))
            {
                return(NotFound($"Employee with {model.EmployeeId} not found"));
            }
            if (Assignments.Exists(model))
            {
                return(Conflict("Assignment already exists"));
            }

            Assignments.Add(model);

            return(Ok("Ok"));
        }