public HttpResponseMessage Get([FromUri] int Id, [FromUri] string[] include, [FromUri] bool indent = false) { try { var formatter = new MaxDepthJsonMediaTypeFormatter() { Indent = indent }; if (include.Length > 0) { formatter.SerializerSettings.MaxDepth = 100; //include.Max<string>(s => s.Split('.').Length * 5); formatter.SerializerSettings.PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.Objects; } else { formatter.SerializerSettings.MaxDepth = 1; } CategoriaCalendario_Idioma categoriacalendario_idioma = categoriacalendario_idiomaRepository.GetById(include, (p => p.Id == Id)); if (categoriacalendario_idioma == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } return(Request.CreateResponse <CategoriaCalendario_Idioma>(HttpStatusCode.OK, categoriacalendario_idioma, formatter)); } catch (Exception _excepcion) { log.Error(_excepcion); return(Request.CreateResponse(HttpStatusCode.InternalServerError, _excepcion)); } }
public ICommandResult Execute(DeleteCategoriaCalendario_IdiomaCommand command) { var CategoriaCalendario_Idioma = CategoriaCalendario_IdiomaRepository.GetById(command.Id); CategoriaCalendario_IdiomaRepository.Delete(CategoriaCalendario_Idioma); unitOfWork.Commit(); return(new CommandResult(true)); }