Esempio n. 1
0
        public async Task <IHttpActionResult> InsertOwner(OwnerInsVM ownervm)
        {
            //obtiene si tiene mensajes pendientes de leer en general retorna true o false
            var response = await owner.InsertOwner(ownervm);

            return(Ok(response));
        }
Esempio n. 2
0
        public async Task <Response <bool> > InsertOwner(OwnerInsVM owner)
        {
            Response <bool> response = new Response <bool>();

            try
            {
                using (var dc = new RentAppEntities())
                {
                    var query = dc.spInsOwner(
                        owner.IdAdmin,
                        owner.Name,
                        owner.Address,
                        owner.Phone,
                        owner.User,
                        owner.Icon,
                        owner.IconString,
                        owner.Password);
                    if (query == -1)
                    {
                        response.Count   = 1;
                        response.Message = null;
                        response.Result  = true;
                    }
                    else
                    {
                        response.Count   = 0;
                        response.Message = "No se pudo guardar el propietario";
                        response.Result  = false;
                    }
                }
                return(response);
            }
            catch (Exception ex)
            {
                response.Count   = 0;
                response.Message = ex.Message;
                response.Result  = false;
                return(response);
            }
        }