/// <summary> /// Function to convert a API NewFormNotice to Client NewNotice /// </summary> /// <param name="newNotice">API NewNoticeForm</param> /// <returns>Client NewNotice</returns> public static CL.NewNotice ToClient(this NewNoticeForm newNotice) { if (newNotice == null) { return(null); } return(new CL.NewNotice { Content = newNotice.Content, IdMovie = newNotice.IdMovie, IdUsers = newNotice.IdUsers }); }
public IActionResult Create([FromBody, SwaggerRequestBody("Form new Notice", Required = true)] NewNoticeForm newNotice) { try { return(Ok(Service.Create(newNotice.ToClient()))); } catch (Exception) { return(new BadRequestObjectResult(new ExceptionResponse() { Status = 400, Value = "Form is Invalid" })); } }