Ejemplo n.º 1
0
        public ReturnObject Update([FromBody] Event entity)
        {
            ReturnObject obj      = new ReturnObject();
            var          userName = getClaimsByToken();
            DaoEvent     daoEvent = new DaoEvent(bookingServicesContext);

            try
            {
                entity.UpdatedBy = userName;
                var data = daoEvent.Update(entity);
                if (data != null)
                {
                    obj.status = 200;
                    obj.data   = data;
                }
                else
                {
                    obj.status = 404;
                }
            }
            catch (Exception ex)
            {
                obj.status  = 404;
                obj.message = ex.StackTrace;
            }
            return(obj);
        }
Ejemplo n.º 2
0
        public ReturnObject delete([FromBody] Delete data)
        {
            ReturnObject obj      = new ReturnObject();
            DaoEvent     daoEvent = new DaoEvent(bookingServicesContext);

            try
            {
                var response = daoEvent.Delete(data.Ids);
                if (response != null)
                {
                    obj.status = 200;
                    obj.data   = response;
                }
                else
                {
                    obj.status = 404;
                }
            }
            catch (Exception ex)
            {
                obj.status  = 404;
                obj.message = ex.StackTrace;
            }
            return(obj);
        }
Ejemplo n.º 3
0
        public ReturnObject GetAll([FromBody] Query query)
        {
            ReturnObject obj      = new ReturnObject();
            DaoEvent     daoEvent = new DaoEvent(bookingServicesContext);

            try
            {
                var data = daoEvent.GetAll(query.PageIndex, query.PageSize, query.Title, query.IsPublish);
                if (data != null)
                {
                    obj.status = 200;
                    obj.data   = data;
                }
                else
                {
                    obj.status = 404;
                }
            }
            catch (Exception ex)
            {
                obj.status  = 404;
                obj.message = ex.StackTrace;
            }
            return(obj);
        }
Ejemplo n.º 4
0
        public ReturnObject Get(string id)
        {
            ReturnObject obj      = new ReturnObject();
            DaoEvent     daoEvent = new DaoEvent(bookingServicesContext);

            try
            {
                var data = daoEvent.getById(id);
                if (data != null)
                {
                    obj.status = 200;
                    obj.data   = data;
                }
                else
                {
                    obj.status = 404;
                }
            }
            catch (Exception ex)
            {
                obj.status  = 404;
                obj.message = ex.StackTrace;
            }
            return(obj);
        }