Example #1
0
        public JsonResultEntity Create([FromBody] EventPlaceLocationEntity eventplacelocationEntity)
        {
            EventPlaceLocationBL eventplacelocationBL = new EventPlaceLocationBL();
            JsonResultEntity     response             = new JsonResultEntity();

            try
            {
                var result = eventplacelocationBL.Create(eventplacelocationEntity);

                if (result.HasWarning())
                {
                    response.Message = String.Join(",", result.Warning);
                    return(response);
                }

                response.Success = true;
                response.Data    = result.Value;
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
                LoggerHelper.Error(ex);
            }

            return(response);
        }
Example #2
0
        public JsonResultEntity Delete(int id)
        {
            var eventplacelocationBL  = new EventPlaceLocationBL();
            JsonResultEntity response = new JsonResultEntity();

            try
            {
                var result = eventplacelocationBL.DeleteById(id);
                if (result.HasWarning())
                {
                    response.Message = String.Join(",", result.Warning);
                    return(response);
                }

                response.Success = true;
                response.Data    = result.Value;
            }
            catch (Exception e)
            {
                response.Message = e.Message;
                LoggerHelper.Error(e);
            }
            return(response);
        }
Example #3
0
        public override JsonResultEntity Get([FromBody] DBParamEntity dbParamEntity)
        {
            EventPlaceLocationBL eventplacelocationBL = new EventPlaceLocationBL();
            JsonResultEntity     response             = new JsonResultEntity();

            try
            {
                var result = eventplacelocationBL.GetAll(dbParamEntity);

                if (result.HasWarning())
                {
                    response.Message = String.Join(",", result.Warning);
                    return(response);
                }

                var dataFound  = eventplacelocationBL.GetTotalRows(dbParamEntity);
                var totalPages = Convert.ToInt32(Math.Ceiling(dataFound.Value / Convert.ToDouble(dbParamEntity.Limit)));

                response.Success  = true;
                response.Data     = result.Value;
                response.MetaInfo = new MetaInfoEntity
                {
                    DataFound   = dataFound.Value,
                    DataPerPage = dbParamEntity.Limit,
                    Page        = dbParamEntity.Page,
                    TotalPages  = totalPages == 0 ? 1 : totalPages
                };
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
                LoggerHelper.Error(ex);
            }

            return(response);
        }