コード例 #1
0
        public async Task <Object> UpdateEmployeeSalaryBySalaryID(Guid businessID, Guid salaryID, [FromForm] UpdateSalaryModel updateSalaryModel)
        {
            var checkBusinessID = await _commonlogic.CheckBusinessID(businessID);  //check that this business is available

            if (checkBusinessID)
            {
                var checkSalaryID = await _commonlogic.CheckSalaryID(businessID, salaryID); //check that this salary id is available in above business

                if (checkSalaryID)
                {
                    //updation starts here
                    var errors = _salaryValidation.ValidateUpdateSalaryData(updateSalaryModel);
                    if (errors != null)
                    {
                        return(errors);
                    }

                    bool response = await _salaryLogic.UpdateEmployeeSalaryBySalaryID(businessID, salaryID, updateSalaryModel);

                    if (response)
                    {
                        return(_salaryValidation.SalaryUpdatedSuccess());
                    }

                    return(_salaryValidation.SalaryUpdatedFailed());
                }

                return(_commonValidation.SalaryIdNotExists(salaryID));
            }

            return(_commonValidation.BusinessIdNotExists(businessID));
        }