public async Task UpdateADMasterDepartment(ADMasterDepartment objADMasterDepartment)
 {
     try
     {
         _Context.Entry(objADMasterDepartment).State = EntityState.Modified;
         await _Context.SaveChangesAsync();
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
 public async Task InsertADMasterDepartment(ADMasterDepartment objADMasterDepartment)
 {
     try
     {
         _Context.ADMasterDepartments.Add(objADMasterDepartment);
         await _Context.SaveChangesAsync();
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Ejemplo n.º 3
0
        public async Task <ActionResult <MasterDepartmentResult> > PostADMasterDepartment(ADMasterDepartment objADMasterDepartment)
        {
            try
            {
                await _IMasterDepartmentInterface.InsertADMasterDepartment(objADMasterDepartment);

                return(CreatedAtAction("GetADMasterDepartment", new { id = objADMasterDepartment.MasterDepartmentId }, objADMasterDepartment));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Ejemplo n.º 4
0
        public async Task <ActionResult <MasterDepartmentResult> > PutADMasterDepartment(long id, ADMasterDepartment objADMasterDepartment)
        {
            if (id != objADMasterDepartment.MasterDepartmentId)
            {
                return(BadRequest());
            }


            try
            {
                await _IMasterDepartmentInterface.UpdateADMasterDepartment(objADMasterDepartment);

                return(_IMasterDepartmentInterface.GetADMasterDepartmentByID(id));
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!_IMasterDepartmentInterface.ADMasterDepartmentExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(NoContent());
        }