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; } Foto_Idioma foto_idioma = foto_idiomaRepository.GetById(include, (p => p.Id == Id)); if (foto_idioma == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } return(Request.CreateResponse <Foto_Idioma>(HttpStatusCode.OK, foto_idioma, formatter)); } catch (Exception _excepcion) { log.Error(_excepcion); return(Request.CreateResponse(HttpStatusCode.InternalServerError, _excepcion)); } }
public ICommandResult Execute(DeleteFoto_IdiomaCommand command) { var Foto_Idioma = Foto_IdiomaRepository.GetById(command.Id); Foto_IdiomaRepository.Delete(Foto_Idioma); unitOfWork.Commit(); return(new CommandResult(true)); }