public async Task <IActionResult> Update([FromBody] CheckListSave checklistBody, int idAppointment, int id) { try { var checkList = EntityBuilder.Call <CheckList>(checklistBody); checkList.Id = id; await _save.Execute(checkList, idAppointment, checklistBody.DateTimeDelivery); return(StatusCode(204)); } catch (NotFoundRegisterException err) { return(StatusCode(404, new { Message = err.Message })); }catch (DateTimeColectedInvalidException err) { return(StatusCode(401, new { Message = err.Message })); } }
public async Task <IActionResult> Create([FromBody] CheckListSave checklistBody, int idAppointment) { try { var path = Startup.ContentRoot; var cheklist = EntityBuilder.Call <CheckList>(checklistBody); var pdfUrl = await _save.Execute(cheklist, idAppointment, checklistBody.DateTimeDelivery, path); return(StatusCode(201, pdfUrl)); } catch (NotFoundRegisterException err) { return(StatusCode(404, new { Message = err.Message })); }catch (CarNotAvalabityException err) { return(StatusCode(401, new { Message = err.Message })); }catch (ClientNotAvalabityException err) { return(StatusCode(401, new { Message = err.Message })); }catch (DateTimeColectedInvalidException err) { return(StatusCode(401, new { Message = err.Message })); }catch (ValuesInvalidException err) { return(StatusCode(401, new { Message = err.Message })); } }