public JsonResultEntity Create([FromBody] UserContentBlockedEntity usercontentblockedEntity) { UserContentBlockedBL usercontentblockedBL = new UserContentBlockedBL(); JsonResultEntity response = new JsonResultEntity(); try { var result = usercontentblockedBL.Create(usercontentblockedEntity); 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 UserContentBlockedEntity Create(UserContentBlockedEntity usercontentblockedEntity) { var query = @"INSERT INTO ""UserContentBlocked""(""SourceName"",""ReferenceID"",""UserProfileID"") VALUES(@SourceName,@ReferenceID,@UserProfileID) RETURNING ""ID"";"; int id = DbConnection.Query <int>(query, usercontentblockedEntity).Single(); usercontentblockedEntity.ID = id; return(usercontentblockedEntity); }
public ResultEntity <UserContentBlockedEntity> Create(UserContentBlockedEntity usercontentblockedEntity) { var validationResult = new ResultEntity <UserContentBlockedEntity>(); using (var usercontentblockedDA = new UserContentBlockedDA()) { validationResult.Value = usercontentblockedDA.Create(usercontentblockedEntity); } return(validationResult); }
public int Update(UserContentBlockedEntity usercontentblockedEntity) { int affectedRows = 0; if (IsHaveId <UserContentBlockedEntity>(usercontentblockedEntity) == false) { var query = @"UPDATE ""UserContentBlocked"" SET ""SourceName""=@SourceName,""ReferenceID""=@ReferenceID,""UserProfileID""=@UserProfileID WHERE ""ID""=@ID"; affectedRows = DbConnection.Execute(query, usercontentblockedEntity); } return(affectedRows); }
public ResultEntity <UserContentBlockedEntity> Update(UserContentBlockedEntity usercontentblockedEntity) { var validationResult = new ResultEntity <UserContentBlockedEntity>(); using (var usercontentblockedDA = new UserContentBlockedDA()) { var resultUpdate = usercontentblockedDA.Update(usercontentblockedEntity); if (resultUpdate <= 0) { validationResult.Warning.Add("Failed Updating UserContentBlocked!"); return(validationResult); } validationResult.Value = usercontentblockedEntity; } return(validationResult); }