public async Task UpdateADMasterVendor(ADMasterVendor objADMasterVendor)
 {
     try
     {
         _Context.Entry(objADMasterVendor).State = EntityState.Modified;
         await _Context.SaveChangesAsync();
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
 public async Task InsertADMasterVendor(ADMasterVendor objADMasterVendor)
 {
     try
     {
         _Context.ADMasterVendors.Add(objADMasterVendor);
         await _Context.SaveChangesAsync();
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
예제 #3
0
        public async Task <ActionResult <MasterVendorResult> > PostADMasterVendor(ADMasterVendor objADMasterVendor)
        {
            try
            {
                await _IMasterVendorInterface.InsertADMasterVendor(objADMasterVendor);

                return(CreatedAtAction("GetADMasterVendor", new { id = objADMasterVendor.MasterVendorId }, objADMasterVendor));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
예제 #4
0
        public async Task <ActionResult <MasterVendorResult> > PutADMasterVendor(long id, ADMasterVendor objADMasterVendor)
        {
            if (id != objADMasterVendor.MasterVendorId)
            {
                return(BadRequest());
            }


            try
            {
                await _IMasterVendorInterface.UpdateADMasterVendor(objADMasterVendor);

                return(_IMasterVendorInterface.GetADMasterVendorByID(id));
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!_IMasterVendorInterface.ADMasterVendorExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(NoContent());
        }