public async Task UpdateADMasterColor(ADMasterColor objADMasterColor)
 {
     try
     {
         _Context.Entry(objADMasterColor).State = EntityState.Modified;
         await _Context.SaveChangesAsync();
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
 public async Task InsertADMasterColor(ADMasterColor objADMasterColor)
 {
     try
     {
         _Context.ADMasterColors.Add(objADMasterColor);
         await _Context.SaveChangesAsync();
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
示例#3
0
        public async Task <ActionResult <MasterColorResult> > PostADMasterColor(ADMasterColor objADMasterColor)
        {
            try
            {
                await _IMasterColorInterface.InsertADMasterColor(objADMasterColor);

                return(CreatedAtAction("GetADMasterColor", new { id = objADMasterColor.MasterColorId }, objADMasterColor));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
示例#4
0
        public async Task <ActionResult <MasterColorResult> > PutADMasterColor(long id, ADMasterColor objADMasterColor)
        {
            if (id != objADMasterColor.MasterColorId)
            {
                return(BadRequest());
            }


            try
            {
                await _IMasterColorInterface.UpdateADMasterColor(objADMasterColor);

                return(_IMasterColorInterface.GetADMasterColorByID(id));
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!_IMasterColorInterface.ADMasterColorExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(NoContent());
        }