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); }
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); }
public ResultEntity <PromoPlaceLocationEntity> Create(PromoPlaceLocationEntity promoplacelocationEntity) { var validationResult = new ResultEntity <PromoPlaceLocationEntity>(); using (var promoplacelocationDA = new PromoPlaceLocationDA()) { validationResult.Value = promoplacelocationDA.Create(promoplacelocationEntity); } return(validationResult); }
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); }
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); }