コード例 #1
0
        public IResultadoOperaciones <Person> Create([FromForm] Person Person)
        {
            foreach (var item in HttpContext.Request.Form.Files)
            {
                var PathPhoto = Person.passport + Path.GetExtension(item.FileName);
                Person.photo = PathPhoto;
                IResultadoOperaciones <Person> result = _PersonServices.Create(Person);

                if (result == null)
                {
                    return(BasicOperationResult <Person> .Fail(result.Message));
                }
                var filePath = "Documentos";

                if (item.Length > 0)
                {
                    using (var stream = new FileStream(Path.Combine(Environment.CurrentDirectory, filePath, PathPhoto), FileMode.Create))
                    {
                        item.CopyToAsync(stream);
                        stream.Close();
                    }
                }
                return(result);
            }
            return(BasicOperationResult <Person> .Fail("No estan todos los datos disponibles"));
        }
コード例 #2
0
        public IResultadoOperaciones <Person> Create(Person entity)
        {
            IResultadoOperaciones <Person> result = _PersonDB.Create(entity);

            if (result == null)
            {
                return(BasicOperationResult <Person> .Fail(result.Message));
            }
            return(result);
        }
コード例 #3
0
        public IResultadoOperaciones <Person> Update(Person Persons)
        {
            IResultadoOperaciones <Person> result = _PersonServices.Update(Persons);

            if (result == null)
            {
                return(BasicOperationResult <Person> .Fail(result.Message));
            }
            return(result);
        }
コード例 #4
0
        public IResultadoOperaciones <Person> Remove([FromQuery] int PersonId)
        {
            IResultadoOperaciones <Person> result = _PersonServices.Remove(PersonId);

            if (result == null)
            {
                return(BasicOperationResult <Person> .Fail(result.Message));
            }
            return(result);
        }
コード例 #5
0
        public IResultadoOperaciones <Request> Remove([FromQuery] int RequestId)
        {
            IResultadoOperaciones <Request> result = _RequestServices.Remove(RequestId);

            if (result == null)
            {
                return(BasicOperationResult <Request> .Fail(result.Message));
            }
            return(result);
        }
コード例 #6
0
        public IResultadoOperaciones <Request> Create(Request entity)
        {
            IResultadoOperaciones <Request> result = _requestDB.Create(entity);

            if (result == null)
            {
                return(BasicOperationResult <Request> .Fail(result.Message));
            }
            return(result);
        }
コード例 #7
0
        public IResultadoOperaciones <Person> Remove(int Id)
        {
            Person PersonDeleted = _PersonDB.Find(ps => ps.Id == Id);

            if (PersonDeleted != null)
            {
                IResultadoOperaciones <Person> deleted = _PersonDB.Delete(PersonDeleted, "Persona eliminado Correctamente");
                return(deleted);
            }
            return(null);
        }
コード例 #8
0
        public IResultadoOperaciones <Request> Update(int RequestId)
        {
            Request RequestUpdate = _RequestServices.GetAll().ToList().Find(x => x.Id == RequestId);
            IResultadoOperaciones <Request> result = _RequestServices.Update(RequestUpdate);

            if (result == null)
            {
                return(BasicOperationResult <Request> .Fail(result.Message));
            }
            return(result);
        }
コード例 #9
0
        public IResultadoOperaciones <Request> Remove(int Id)
        {
            Request RequestDeleted = _requestDB.Find(ps => ps.Id == Id);

            if (RequestDeleted != null)
            {
                IResultadoOperaciones <Request> deleted = _requestDB.Delete(RequestDeleted, "Solicitud eliminado Correctamente");
                return(deleted);
            }
            return(null);
        }
コード例 #10
0
        public IResultadoOperaciones <Request> Create([FromBody] Request Request)
        {
            Request.statusId     = 1;
            Request.creationDate = DateTime.Now;
            IResultadoOperaciones <Request> result = _RequestServices.Create(Request);

            if (result == null)
            {
                return(BasicOperationResult <Request> .Fail(result.Message));
            }

            return(result);
        }
コード例 #11
0
        public IResultadoOperaciones <Person> Update(Person entity)
        {
            IResultadoOperaciones <Person> Updated = _PersonDB.Update(entity, "Persona Actualizado Correctamente");

            return(Updated);
        }
コード例 #12
0
        public IResultadoOperaciones <Request> Update(Request entity)
        {
            IResultadoOperaciones <Request> Updated = _requestDB.Delete(entity, "Persona Actualizado Correctamente");

            return(Updated);
        }