Example #1
0
 public HttpResponseMessage Get([FromUri] short 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;
         }
         TipoEvento_Idioma tipoevento_idioma = tipoevento_idiomaRepository.GetById(include, (p => p.Id == Id));
         if (tipoevento_idioma == null)
         {
             throw new HttpResponseException(HttpStatusCode.NotFound);
         }
         return(Request.CreateResponse <TipoEvento_Idioma>(HttpStatusCode.OK, tipoevento_idioma, formatter));
     } catch (Exception _excepcion) {
         log.Error(_excepcion);
         return(Request.CreateResponse(HttpStatusCode.InternalServerError, _excepcion));
     }
 }
Example #2
0
        public ICommandResult Execute(DeleteTipoEvento_IdiomaCommand command)
        {
            var TipoEvento_Idioma = TipoEvento_IdiomaRepository.GetById(command.Id);

            TipoEvento_IdiomaRepository.Delete(TipoEvento_Idioma);
            unitOfWork.Commit();
            return(new CommandResult(true));
        }