コード例 #1
0
        public JsonResultEntity Create([FromBody] EventCategoryEntity eventcategoryEntity)
        {
            EventCategoryBL  eventcategoryBL = new EventCategoryBL();
            JsonResultEntity response        = new JsonResultEntity();

            try
            {
                var result = eventcategoryBL.Create(eventcategoryEntity);

                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);
        }
コード例 #2
0
        public EventCategoryEntity Create(EventCategoryEntity eventcategoryEntity)
        {
            var query = @"INSERT INTO ""EventCategory""(""CategoryName"",""Description"",""Logo"",""ModifiedDate"") VALUES(@CategoryName,@Description,@Logo,@ModifiedDate) RETURNING ""ID"";";

            int id = DbConnection.Query <int>(query, eventcategoryEntity).Single();

            eventcategoryEntity.ID = id;
            return(eventcategoryEntity);
        }
コード例 #3
0
        public ResultEntity <EventCategoryEntity> Create(EventCategoryEntity eventcategoryEntity)
        {
            var validationResult = new ResultEntity <EventCategoryEntity>();

            using (var eventcategoryDA = new EventCategoryDA())
            {
                validationResult.Value = eventcategoryDA.Create(eventcategoryEntity);
            }

            return(validationResult);
        }
コード例 #4
0
        public int Update(EventCategoryEntity eventcategoryEntity)
        {
            int affectedRows = 0;

            if (IsHaveId <EventCategoryEntity>(eventcategoryEntity) == false)
            {
                var query = @"UPDATE ""EventCategory"" SET ""CategoryName""=@CategoryName,""Description""=@Description,""Logo""=@Logo,""ModifiedDate""=@ModifiedDate WHERE ""ID""=@ID";
                affectedRows = DbConnection.Execute(query, eventcategoryEntity);
            }

            return(affectedRows);
        }
コード例 #5
0
        public ResultEntity <EventCategoryEntity> Update(EventCategoryEntity eventcategoryEntity)
        {
            var validationResult = new ResultEntity <EventCategoryEntity>();

            using (var eventcategoryDA = new EventCategoryDA())
            {
                var resultUpdate = eventcategoryDA.Update(eventcategoryEntity);

                if (resultUpdate <= 0)
                {
                    validationResult.Warning.Add("Failed Updating EventCategory!");
                    return(validationResult);
                }

                validationResult.Value = eventcategoryEntity;
            }

            return(validationResult);
        }