public JsonResultEntity Create([FromBody] PlaceCategoryEntity placecategoryEntity) { PlaceCategoryBL placecategoryBL = new PlaceCategoryBL(); JsonResultEntity response = new JsonResultEntity(); try { var result = placecategoryBL.Create(placecategoryEntity); 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 PlaceCategoryEntity Create(PlaceCategoryEntity placecategoryEntity) { var query = @"INSERT INTO ""PlaceCategory""(""CategoryName"",""Description"",""Logo"",""ModifiedDate"",""Tag"",""IsPremium"") VALUES(@CategoryName,@Description,@Logo,@ModifiedDate,@Tag,@IsPremium) RETURNING ""ID"";"; int id = DbConnection.Query <int>(query, placecategoryEntity).Single(); placecategoryEntity.ID = id; return(placecategoryEntity); }
public ResultEntity <PlaceCategoryEntity> Create(PlaceCategoryEntity placecategoryEntity) { var validationResult = new ResultEntity <PlaceCategoryEntity>(); using (var placecategoryDA = new PlaceCategoryDA()) { validationResult.Value = placecategoryDA.Create(placecategoryEntity); } return(validationResult); }
public int Update(PlaceCategoryEntity placecategoryEntity) { int affectedRows = 0; if (IsHaveId <PlaceCategoryEntity>(placecategoryEntity) == false) { var query = @"UPDATE ""PlaceCategory"" SET ""CategoryName""=@CategoryName,""Description""=@Description,""Logo""=@Logo,""ModifiedDate""=@ModifiedDate,""Tag""=@Tag,""IsPremium""=@IsPremium WHERE ""ID""=@ID"; affectedRows = DbConnection.Execute(query, placecategoryEntity); } return(affectedRows); }
public ResultEntity <PlaceCategoryEntity> Update(PlaceCategoryEntity placecategoryEntity) { var validationResult = new ResultEntity <PlaceCategoryEntity>(); using (var placecategoryDA = new PlaceCategoryDA()) { var resultUpdate = placecategoryDA.Update(placecategoryEntity); if (resultUpdate <= 0) { validationResult.Warning.Add("Failed Updating PlaceCategory!"); return(validationResult); } validationResult.Value = placecategoryEntity; } return(validationResult); }