public object ValidateUpdateIncrementData(IncrementsUpdateModel incrementsUpdateModel) { ResponseList = new List <object>(); if (incrementsUpdateModel.IncrementAmount <= 0) { Success = "Failed"; ResponseList.Add(_incrementsResponseMessages.InvalidAmount()); } if (string.IsNullOrEmpty(incrementsUpdateModel.Description.Trim())) { Success = "Failed"; ResponseList.Add(_incrementsResponseMessages.DescNotProvided()); } else { if (incrementsUpdateModel.Description.Length > 100) { Success = "Failed"; ResponseList.Add(_incrementsResponseMessages.DescExceedsLimit()); } } if (Success != null) { return(this); } return(null); }
public async Task UpdateIncrementByID(Guid businessID, Guid incrementID, IncrementsUpdateModel incrementsUpdateModel) { var businessId = new Npgsql.NpgsqlParameter("@thebusinessid", businessID); var incrementId = new Npgsql.NpgsqlParameter("@theincrementid", incrementID); var amount = new Npgsql.NpgsqlParameter("@theamount", incrementsUpdateModel.IncrementAmount); var description = new Npgsql.NpgsqlParameter("@thedescription", incrementsUpdateModel.Description); await Task.Run(() => _projectContextDB.Database.ExecuteSqlRaw("call updateincrementbyid(@thebusinessid,@theincrementid,@theamount,@thedescription)", businessId, incrementId, amount, description)); }
public Task UpdateIncrementByID(Guid businessID, Guid incrementID, IncrementsUpdateModel incrementsUpdateModel) { return(_incrementsDAL.UpdateIncrementByID(businessID, incrementID, incrementsUpdateModel)); }
public async Task <object> UpdateIncrementByID(Guid businessID, Guid incrementID, IncrementsUpdateModel incrementsUpdateModel) { var checkBusinessId = await _commonLogic.CheckBusinessID(businessID); if (checkBusinessId) { var checkIncrementId = await _commonLogic.CheckIncrementID(businessID, incrementID); if (checkIncrementId) { var errors = _incrementsValidation.ValidateUpdateIncrementData(incrementsUpdateModel); if (errors != null) { return(errors); } await _incrementsLogic.UpdateIncrementByID(businessID, incrementID, incrementsUpdateModel); return(_incrementsValidation.IncrementUpdatedSuccess()); } return(_commonValidation.IncrementIdNotExists(incrementID)); } return(_commonValidation.BusinessIdNotExists(businessID)); }