Beispiel #1
0
 public async Task <bool> Create_Desafio(int profId,
                                         CreateDesafioViewModel model)
 {
     try
     {
         _data.AddDesafio(model.Map(profId));
         return(await _data.SaveAllAsync());
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         throw new ApplicationServicesException(
                   "Error en la creación de desafío");
     }
 }
Beispiel #2
0
        public async Task <ApiResult <bool> > Create_Desafio(int profId,
                                                             CreateDesafioViewModel model)
        {
            var result = ApiResult <bool> .Initialize(false);

            try
            {
                _data.AddDesafio(model.Map(profId));
                result.Value = await _data.SaveAllAsync();

                result.Success = result.Value;
                return(result);
            }
            catch (Exception e)
            {
                result.AddError("", "Error en la creación de desafío");
                return(result);
            }
        }