Пример #1
0
        public async Task <IActionResult> PutExpenseType(int id, ExpenseTypeDTO expenseTypeDTO)
        {
            if (id != expenseTypeDTO.Id)
            {
                return(Conflict(new RespStatus {
                    Status = "Failure", Message = "Id is invalid"
                }));
            }

            var expType = await _context.ExpenseTypes.FindAsync(id);

            expType.ExpenseTypeName = expenseTypeDTO.ExpenseTypeName;
            expType.ExpenseTypeDesc = expenseTypeDTO.ExpenseTypeDesc;
            expType.StatusTypeId    = expenseTypeDTO.StatusTypeId;
            _context.ExpenseTypes.Update(expType);

            //_context.Entry(expenseType).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                throw;
            }

            return(Ok(new RespStatus {
                Status = "Success", Message = "Expsense Type Details Updated!"
            }));
        }
Пример #2
0
        public async Task <IActionResult> PutExpenseSubClaim(int id, ExpenseSubClaim expenseSubClaim)
        {
            if (id != expenseSubClaim.Id)
            {
                return(BadRequest());
            }

            _context.Entry(expenseSubClaim).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ExpenseSubClaimExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Ok(new RespStatus {
                Status = "Success", Message = "Expense Approval Updated!"
            }));
        }
Пример #3
0
        public async Task <IActionResult> PutProject(int id, ProjectDTO projectDto)
        {
            if (id != projectDto.Id)
            {
                return(BadRequest());
            }

            var proj = await _context.Projects.FindAsync(id);

            proj.Id           = projectDto.Id;
            proj.ProjectName  = projectDto.ProjectName;
            proj.CostCentreId = projectDto.CostCentreId;
            proj.ProjectDesc  = projectDto.ProjectDesc;

            _context.Projects.Update(proj);
            //_context.Entry(projectDto).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProjectExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Пример #4
0
        public async Task <IActionResult> PutStatusType(int id, StatusType statusType)
        {
            if (id != statusType.Id)
            {
                return(Conflict(new RespStatus {
                    Status = "Failure", Message = "Status Type Id is Invalid"
                }));
            }

            var statustyp = await _context.StatusTypes.FindAsync(id);

            statustyp.Status = statusType.Status;
            _context.StatusTypes.Update(statustyp);

            //_context.Entry(statusType).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                throw;
            }

            return(Conflict(new RespStatus {
                Status = "Failure", Message = "Status Type is Updated!"
            }));
        }
        public async Task <IActionResult> PutApprovalGroup(int id, ApprovalGroup approvalGroup)
        {
            if (id != approvalGroup.Id)
            {
                return(BadRequest());
            }

            _context.Entry(approvalGroup).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ApprovalGroupExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutDisbursementsAndClaimsMaster(int id, DisbursementsAndClaimsMasterDTO disbursementsAndClaimsMasterDto)
        {
            if (id != disbursementsAndClaimsMasterDto.Id)
            {
                return(BadRequest());
            }

            var disbursementsAndClaimsMaster = await _context.DisbursementsAndClaimsMasters.FindAsync(id);

            disbursementsAndClaimsMaster.Id                    = disbursementsAndClaimsMasterDto.Id;
            disbursementsAndClaimsMaster.Id                    = disbursementsAndClaimsMasterDto.Id;
            disbursementsAndClaimsMaster.EmployeeId            = disbursementsAndClaimsMasterDto.EmployeeId;
            disbursementsAndClaimsMaster.PettyCashRequestId    = disbursementsAndClaimsMasterDto.PettyCashRequestId;
            disbursementsAndClaimsMaster.ExpenseReimburseReqId = disbursementsAndClaimsMasterDto.ExpenseReimburseReqId;
            disbursementsAndClaimsMaster.AdvanceOrReimburseId  = disbursementsAndClaimsMasterDto.AdvanceOrReimburseId;
            disbursementsAndClaimsMaster.ProjectId             = disbursementsAndClaimsMasterDto.ProjectId;
            disbursementsAndClaimsMaster.SubProjectId          = disbursementsAndClaimsMasterDto.SubProjectId;
            disbursementsAndClaimsMaster.WorkTaskId            = disbursementsAndClaimsMasterDto.WorkTaskId;
            disbursementsAndClaimsMaster.RecordDate            = disbursementsAndClaimsMasterDto.RecordDate;
            disbursementsAndClaimsMaster.Amount                = disbursementsAndClaimsMasterDto.Amount;
            disbursementsAndClaimsMaster.CostCentreId          = disbursementsAndClaimsMasterDto.CostCentreId;
            disbursementsAndClaimsMaster.ApprovalStatusId      = disbursementsAndClaimsMasterDto.ApprovalStatusId;


            _context.DisbursementsAndClaimsMasters.Update(disbursementsAndClaimsMaster);
            //_context.Entry(disbursementsAndClaimsMasterDTO).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DisbursementsAndClaimsMasterExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Пример #7
0
        public async Task <IActionResult> PutProject(int id, ProjectDTO projectDto)
        {
            if (id != projectDto.Id)
            {
                return(Conflict(new RespStatus {
                    Status = "Failure", Message = "Id is invalid"
                }));
            }

            var proj = await _context.Projects.FindAsync(id);

            proj.Id               = projectDto.Id;
            proj.ProjectName      = projectDto.ProjectName;
            proj.CostCenterId     = projectDto.CostCenterId;
            proj.ProjectManagerId = projectDto.ProjectManagerId;
            proj.ProjectDesc      = projectDto.ProjectDesc;
            proj.StatusTypeId     = projectDto.StatusTypeId;

            _context.Projects.Update(proj);
            //_context.Entry(projectDto).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProjectExists(id))
                {
                    return(Conflict(new RespStatus {
                        Status = "Failure", Message = "Project is invalid"
                    }));
                }
                else
                {
                    throw;
                }
            }

            return(Ok(new RespStatus {
                Status = "Success", Message = "Project Details Updated!"
            }));
        }