public async Task <IActionResult> PutUserMaster(Guid id, UserMaster userMaster)
        {
            if (id != userMaster.UserId)
            {
                GenericMethods.Log(LogType.ActivityLog.ToString(), "PutUserMaster: -user not matched");
                return(BadRequest("User not matched."));
            }

            _context.Entry(userMaster).State = EntityState.Modified;

            try
            {
                GenericMethods.Log(LogType.ActivityLog.ToString(), "PutUserMaster: " + userMaster.Email + "-user updated successfully");
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!UserMasterExists(id))
                {
                    GenericMethods.Log(LogType.ErrorLog.ToString(), "PutUserMaster: -get user failed");
                    return(NotFound("User not found"));
                }
                else
                {
                    GenericMethods.Log(LogType.ErrorLog.ToString(), "PutUserMaster: -get user failed");
                    throw;
                }
            }

            return(Ok(StatusCodes.Status200OK));
        }
Пример #2
0
        public async Task <IActionResult> PutTargetMaster(int id, TargetMaster targetMaster)
        {
            if (id != targetMaster.TagetId)
            {
                return(BadRequest());
            }

            _context.Entry(targetMaster).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TargetMasterExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Пример #3
0
        public async Task <IActionResult> PutCallOutcomeMaster(int id, CallOutcomeMaster callOutcomeMaster)
        {
            if (id != callOutcomeMaster.OutComeId)
            {
                return(BadRequest());
            }

            _context.Entry(callOutcomeMaster).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CallOutcomeMasterExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Пример #4
0
        public async Task <IActionResult> PutAppoinmentStatusMaster(int id, AppoinmentStatusMaster appoinmentStatusMaster)
        {
            if (id != appoinmentStatusMaster.AppoinStatusId)
            {
                return(BadRequest());
            }

            _context.Entry(appoinmentStatusMaster).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AppoinmentStatusMasterExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Пример #5
0
        public async Task <IActionResult> PutAdminSetting(int id, AdminSetting adminSetting)
        {
            if (id != adminSetting.SettingId)
            {
                return(BadRequest());
            }

            _context.Entry(adminSetting).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AdminSettingExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }