public async Task UpdateASMasterSubCategory(ASMasterSubCategory objADMasterSubCategory)
 {
     try
     {
         _Context.Entry(objADMasterSubCategory).State = EntityState.Modified;
         await _Context.SaveChangesAsync();
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
 public async Task InsertASMasterSubCategory(ASMasterSubCategory objADMasterSubCategory)
 {
     try
     {
         _Context.ASMasterSubCategories.Add(objADMasterSubCategory);
         await _Context.SaveChangesAsync();
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Exemple #3
0
        public async Task <ActionResult <MasterSubCategoryResult> > PutASMasterSubCategory(long id, ASMasterSubCategory objADMasterSubCategory)
        {
            if (id != objADMasterSubCategory.MasterSubCategoryId)
            {
                return(BadRequest());
            }


            try
            {
                await _IMasterSubCategoryInterface.UpdateASMasterSubCategory(objADMasterSubCategory);

                return(_IMasterSubCategoryInterface.GetASMasterSubCategoryByID(id));
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!_IMasterSubCategoryInterface.ASMasterSubCategoryExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(NoContent());
        }
Exemple #4
0
        public async Task <ActionResult <MasterSubCategoryResult> > PostASMasterSubCategory(ASMasterSubCategory objADMasterSubCategory)
        {
            try
            {
                await _IMasterSubCategoryInterface.InsertASMasterSubCategory(objADMasterSubCategory);

                return(CreatedAtAction("GetASMasterSubCategory", new { id = objADMasterSubCategory.MasterSubCategoryId }, objADMasterSubCategory));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }