public async Task <IActionResult> Add(UsserLoad usser)
        {
            try
            {
                var result = await _add.Add(usser);

                return(result != false?Ok(result) : (NoContent()));
            }
            catch (Exception e)
            {
                return(NotFound(e.Message));
            }
        }
Esempio n. 2
0
        public async Task <bool> Add(string url, UsserLoad usser)
        {
            try
            {
                Base.EndPoint = url;
                var result = await _data.PostBool(usser);

                return(result);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
        public async Task <bool> Add(UsserLoad usser)
        {
            try
            {
                var map = _mapper.Map <UsserInfo>(usser);
                _context.Usser.Add(map);
                await _context.SaveChangesAsync();

                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
        public async Task <IActionResult> Save(UsserLoad usser)
        {
            try
            {
                var url    = _config.GetValue <string>("UrlSave");
                var result = await _add.Add(url, usser);

                if (result != false)
                {
                    ViewBag.Alert = "Tu informacion ha sido recibida satisfactoriamente.";
                    return(View("Index"));
                }
                else
                {
                    ViewBag.Alert = "Ocurrió un error, por favor intente de nuevo.";
                    return(View("Index"));
                }
            }
            catch (Exception e)
            {
                return(null);
            }
        }