Пример #1
0
 public async Task UpdateASMasterProductType(ASMasterProductType objADMasterProductType)
 {
     try
     {
         _Context.Entry(objADMasterProductType).State = EntityState.Modified;
         await _Context.SaveChangesAsync();
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Пример #2
0
 public async Task InsertASMasterProductType(ASMasterProductType objADMasterProductType)
 {
     try
     {
         _Context.ASMasterProductTypes.Add(objADMasterProductType);
         await _Context.SaveChangesAsync();
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
        public async Task <ActionResult <MasterProductTypeResult> > PutASMasterProductType(long id, ASMasterProductType objADMasterProductType)
        {
            if (id != objADMasterProductType.MasterProductTypeId)
            {
                return(BadRequest());
            }


            try
            {
                await _IMasterProductTypeInterface.UpdateASMasterProductType(objADMasterProductType);

                return(_IMasterProductTypeInterface.GetASMasterProductTypeByID(id));
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!_IMasterProductTypeInterface.ASMasterProductTypeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(NoContent());
        }
        public async Task <ActionResult <MasterProductTypeResult> > PostASMasterProductType(ASMasterProductType objADMasterProductType)
        {
            try
            {
                await _IMasterProductTypeInterface.InsertASMasterProductType(objADMasterProductType);

                return(CreatedAtAction("GetASMasterProductType", new { id = objADMasterProductType.MasterProductTypeId }, objADMasterProductType));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }