コード例 #1
0
        public JsonResultEntity Create([FromBody] PromoPlaceLocationEntity promoplacelocationEntity)
        {
            PromoPlaceLocationBL promoplacelocationBL = new PromoPlaceLocationBL();
            JsonResultEntity     response             = new JsonResultEntity();

            try
            {
                var result = promoplacelocationBL.Create(promoplacelocationEntity);

                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 PromoPlaceLocationEntity Create(PromoPlaceLocationEntity promoplacelocationEntity)
        {
            var query = @"INSERT INTO ""PromoPlaceLocation""(""PlaceID"",""PromoID"") VALUES(@PlaceID,@PromoID) RETURNING ""ID"";";

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

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

            using (var promoplacelocationDA = new PromoPlaceLocationDA())
            {
                validationResult.Value = promoplacelocationDA.Create(promoplacelocationEntity);
            }

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

            if (IsHaveId <PromoPlaceLocationEntity>(promoplacelocationEntity) == false)
            {
                var query = @"UPDATE ""PromoPlaceLocation"" SET ""PlaceID""=@PlaceID,""PromoID""=@PromoID WHERE ""ID""=@ID";
                affectedRows = DbConnection.Execute(query, promoplacelocationEntity);
            }

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

            using (var promoplacelocationDA = new PromoPlaceLocationDA())
            {
                var resultUpdate = promoplacelocationDA.Update(promoplacelocationEntity);

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

                validationResult.Value = promoplacelocationEntity;
            }

            return(validationResult);
        }