public bool DeleteUser(int id) { try { using (UnitOfWork db = new UnitOfWork()) { db.UserRepository.Delete(id); return(true); } } catch (Exception ex) { string InputData = string.Format(CultureInfo.InvariantCulture, "client_id: {0}", id); ErrorLogService.LogErrorOccured("Error", "DeleteUser", InputData, ex.Message, 0, "UserService", ex.ToString()); return(false); } }
public bool AddEditUser(UserModel model) { User entity = new User(); try { entity.Id = model.Id; entity.Firstname = model.Firstname; entity.Lastname = model.Lastname; entity.Phone = model.Phone; entity.EmailId = model.EmailId; entity.CountryId = model.CountryId; entity.CityId = model.CityId; entity.Gender = model.Gender; entity.Hobbies = string.Join(",", model.HobbyList.Where(x => x.IsSelected == true).Select(x => x.Id)); if (model.PhotoUrl != null) { entity.PhotoUrl = model.PhotoUrl; } else { entity.PhotoUrl = model.hdnPhotoUrl; } using (UnitOfWork db = new UnitOfWork()) { if (model.Id > 0) { db.UserRepository.Update(entity); } else { db.UserRepository.Insert(entity); } } return(true); } catch (Exception ex) { string InputData = string.Format(CultureInfo.InvariantCulture, "client_id: {0}", model.Id); ErrorLogService.LogErrorOccured("Error", "AddEditUser", InputData, ex.Message, 0, "UserService", ex.ToString()); return(false); } }