Ejemplo n.º 1
0
        public async Task <IActionResult> UpdateDescipline(int id, [FromBody] DesciplineDto model)
        {
            var response = await _clientService.PutAsync($"{_settings.Value.OilApiAddress}Descipline/UpdateDescipline/{id}", model);

            var content = await response.Content.ReadAsStringAsync();

            return(new ObjectResult(content));
        }
Ejemplo n.º 2
0
        public IActionResult CreateDescipline(DesciplineDto model,
                                              [FromServices] IActionService <IPlaceDesciplineAction> service)
        {
            var dto        = new PlaceDesciplineDto(model);
            var descipline = service.RunBizAction <Descipline>(dto);

            if (!service.Status.HasErrors)
            {
                return(new ObjectResult(new ResultResponseDto <String, int>
                {
                    Key = HttpStatusCode.OK,
                    Value = "Descipline Created...",
                    Subject = descipline.Id
                }));
            }

            var errors = service.Status.CopyErrorsToString(ModelState);

            service.Status.CopyErrorsToString(ModelState);
            return(new ObjectResult(new ResultResponseDto <String, int> {
                Key = HttpStatusCode.BadRequest, Value = errors
            }));
        }
Ejemplo n.º 3
0
        public IActionResult UpdateDescipline(int id, [FromBody] DesciplineDto model,
                                              [FromServices] IActionService <IUpdateDesciplineAction> service)
        {
            model.Id = id;
            var dto = new PlaceDesciplineDto(model);

            service.RunBizAction(dto);

            if (!service.Status.HasErrors)
            {
                return(new ObjectResult(new ResultResponseDto <String, int>
                {
                    Key = HttpStatusCode.OK,
                    Value = "Descipline updated..",
                    Subject = model.Id
                }));
            }

            var errors = service.Status.CopyErrorsToString(ModelState);

            return(new ObjectResult(new ResultResponseDto <String, int> {
                Key = HttpStatusCode.BadRequest, Value = errors, Subject = model.Id
            }));
        }
Ejemplo n.º 4
0
 public PlaceDesciplineDto(DesciplineDto descipline)
 {
     this.Descipline = descipline;
 }