public JsonResultEntity Create([FromBody] EventOrganizerEntity eventorganizerEntity)
        {
            EventOrganizerBL eventorganizerBL = new EventOrganizerBL();
            JsonResultEntity response         = new JsonResultEntity();

            try
            {
                var result = eventorganizerBL.Create(eventorganizerEntity);

                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);
        }
Ejemplo n.º 2
0
        public EventOrganizerEntity Create(EventOrganizerEntity eventorganizerEntity)
        {
            var query = @"INSERT INTO ""EventOrganizer""(""Name"",""Description"",""Phone1"",""Phone2"",""Logo"",""ShortName"",""LongDescription"",""LogoChecksum"") VALUES(@Name,@Description,@Phone1,@Phone2,@Logo,@ShortName,@LongDescription,@LogoChecksum) RETURNING ""ID"";";

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

            eventorganizerEntity.ID = id;
            return(eventorganizerEntity);
        }
Ejemplo n.º 3
0
        public ResultEntity <EventOrganizerEntity> Create(EventOrganizerEntity eventorganizerEntity)
        {
            var validationResult = new ResultEntity <EventOrganizerEntity>();

            using (var eventorganizerDA = new EventOrganizerDA())
            {
                validationResult.Value = eventorganizerDA.Create(eventorganizerEntity);
            }

            return(validationResult);
        }
Ejemplo n.º 4
0
        public int Update(EventOrganizerEntity eventorganizerEntity)
        {
            int affectedRows = 0;

            if (IsHaveId <EventOrganizerEntity>(eventorganizerEntity) == false)
            {
                var query = @"UPDATE ""EventOrganizer"" SET ""Name""=@Name,""Description""=@Description,""Phone1""=@Phone1,""Phone2""=@Phone2,""Logo""=@Logo,""ShortName""=@ShortName,""LongDescription""=@LongDescription,""ModifiedDate""=@ModifiedDate,""LogoChecksum""=@LogoChecksum WHERE ""ID""=@ID";
                affectedRows = DbConnection.Execute(query, eventorganizerEntity);
            }

            return(affectedRows);
        }
Ejemplo n.º 5
0
        public ResultEntity <EventOrganizerEntity> Update(EventOrganizerEntity eventorganizerEntity)
        {
            var validationResult = new ResultEntity <EventOrganizerEntity>();

            eventorganizerEntity.ModifiedDate = DateTime.Now;

            using (var eventorganizerDA = new EventOrganizerDA())
            {
                var resultUpdate = eventorganizerDA.Update(eventorganizerEntity);

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

                validationResult.Value = eventorganizerEntity;
            }

            return(validationResult);
        }