コード例 #1
0
        public async Task <AdminResponse> Authenticate(string userName, string password)
        {
            _logger.LogInfo("Authentication method called");
            try
            {
                AdminUser adminUser = _mapper.Map <AdminUser>(_adminUserRepo.GetAdminUser(userName));
                if (adminUser == null)
                {
                    _logger.LogError("User doesn't exist");
                    throw new Exception(string.Format(_messageHandler.GetMessage(ErrorMessagesEnum.AuthUserDoesNotExists)));
                }
                if (!VerifyPasswordHash(password, adminUser.PasswordHash, adminUser.PasswordSalt))
                {
                    _logger.LogError("Invalid credential");
                    throw new Exception(string.Format(_messageHandler.GetMessage(ErrorMessagesEnum.AuthWrongCredentials)));
                }
                _logger.LogInfo("JWT Token creation initiatted");
                var token = await _jwtFactory.GenerateEncodedToken(adminUser.Id.ToString(), adminUser.UserName, adminUser.Role);

                _logger.LogInfo("Successfully generate JWT Token");
                AdminResponse response = new AdminResponse(true, string.Format(_messageHandler.GetSuccessMessage(SuccessMessagesEnum.SuccessfullyLoggedIn)));
                response.Token = token;
                return(response);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
                return(new AdminResponse(false, ex.Message));
            }
        }
コード例 #2
0
 public AdminResponse Register(AdminUserViewModel adminUserData)
 {
     _logger.LogInfo("Registration method called");
     byte[] passwordHash, passwordSalt;
     try
     {
         AdminUser adminUser = _mapper.Map <AdminUser>(_adminUserRepo.GetAdminUser(adminUserData.UserName));
         if (adminUser != null)
         {
             _logger.LogInfo("The user doesn't not exists");
             throw new Exception(string.Format(_messageHandler.GetMessage(ErrorMessagesEnum.UserAlreadyExist)));
         }
         else
         {
             adminUser = _mapper.Map <AdminUser>(adminUserData);
         }
         CreatePasswordHash(adminUserData.Password, out passwordHash, out passwordSalt);
         _logger.LogInfo("HMACSHA512 password created");
         adminUser.PasswordHash = passwordHash;
         adminUser.PasswordSalt = passwordSalt;
         _adminUserRepo.Register(adminUser);
         _logger.LogInfo("Successfully registered new admin user by role = " + adminUserData.Role);
         adminUserData.Password        = null;
         adminUserData.ConfirmPassword = null;
         AdminResponse response = new AdminResponse(true, string.Format(_messageHandler.GetSuccessMessage(SuccessMessagesEnum.SuccessfullRegister)));
         response.AdminUser = adminUserData;
         return(response);
     }
     catch (Exception ex)
     {
         _logger.LogError(ex.Message);
         return(new AdminResponse(false, ex.Message));
     }
 }
コード例 #3
0
ファイル: PTOService.cs プロジェクト: Ashis27/Hiroshima
        public async Task <AdminResponse> UpdatePTO(PTOInformationViewModel ptoInformation)
        {
            _logger.LogInfo("Trying to update existing PTO information");
            try
            {
                //Get Existing PTO info based on PTO
                PTOInformation ptoInfo = await this._ptoRepository.GetActivePTO(ptoInformation.Id);

                //If null then throw exception with invalid information
                if (ptoInfo == null)
                {
                    return(new AdminResponse(false, string.Format(_messageHandler.GetMessage(ErrorMessagesEnum.InValidPTOInformation))));
                }

                PTODescription ptoDesc = new PTODescription();
                //if null then update only PTO information otherwise update PTO description
                if (ptoInformation.PTODescription != null && ptoInformation.PTODescription.Count() > 0)
                {
                    //Get Existing PTO desc based on PTO desc id
                    ptoDesc = ptoInfo.PTODescription?.Where(p => p.Id == ptoInformation.PTODescription.FirstOrDefault().Id&& p.SelectedLanguage == ptoInformation.PTODescription.FirstOrDefault().SelectedLanguage&& p.IsActive).FirstOrDefault();

                    ////mapped view model to entity
                    ptoInfo = _mapper.Map <PTOInformation>(ptoInformation);

                    //If null then add new PTO desc with selected language otherwise update existing PTO desc.
                    if (ptoDesc != null)
                    {
                        //update existing entity from edited by user
                        ptoDesc = ptoInfo.PTODescription.FirstOrDefault();

                        //Updated PTO information
                        _ptoRepository.UpdatePTO(ptoInfo);
                        _logger.LogInfo("Successfully updated PTO information");

                        //Updated PTO description
                        _ptoDescriptionRepository.UpdatePTODesc(ptoDesc);
                        _logger.LogInfo("Successfully updated PTO Description information");
                    }
                    else
                    {
                        //Added new PTO description if new language selected by user
                        _ptoDescriptionRepository.AddPTODesc(ptoInfo.PTODescription.FirstOrDefault());
                        _logger.LogInfo("Successfully added PTO description information");
                    }
                }
                else
                {
                    return(new AdminResponse(false, string.Format(_messageHandler.GetMessage(ErrorMessagesEnum.InValidPTODescription))));
                }

                AdminResponse response = new AdminResponse(true, string.Format(_messageHandler.GetSuccessMessage(SuccessMessagesEnum.SuccessfullySaved)));
                response.PTOInformation = ptoInformation;
                return(response);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
                return(new AdminResponse(false, ex.Message));
            }
        }
コード例 #4
0
        public AdminResponse Mapper(DAO.Response.AdminResponse model)
        {
            AdminResponse response = new AdminResponse();

            response.Id         = model.Id;
            response.Account    = model.Account;
            response.Name       = model.Name;
            response.CreateTime = model.CreateTime;

            return(response);
        }
コード例 #5
0
        public AdminResponse Mapper(Admin admin)
        {
            AdminResponse response = new AdminResponse();

            response.Id         = admin.Id;
            response.Account    = admin.Account;
            response.Password   = admin.Password;
            response.Name       = admin.Name;
            response.CreateTime = admin.CreateTime;

            return(response);
        }
コード例 #6
0
 public ViewResult KaishaForm(AdminResponse adminResponse)
 {
     // TODO: store response from guest
     if (ModelState.IsValid)
     {
         Repository.AddResponse(adminResponse);
         return(View("Arigato", adminResponse));
     }
     else
     {
         return(View());
     }
 }
コード例 #7
0
        public async Task <bool> AddAdminResponse(AdminResponse response)
        {
            await _dataContext.AdminResponces.AddAsync(response);

            try
            {
                await _dataContext.SaveChangesAsync();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
コード例 #8
0
        public async Task <AdminResponse> UpdateAdmin(AdminUserViewModel adminUserData)
        {
            _logger.LogInfo("Update Admin method called by role " + adminUserData.Role);
            byte[] passwordHash, passwordSalt;
            try
            {
                //Get active admin user by id
                AdminUser adminUser = await _adminUserRepo.GetAdminUserById(adminUserData.Id);

                if (adminUser == null)
                {
                    _logger.LogInfo("The user doesn't not exists");
                    throw new Exception(string.Format(_messageHandler.GetMessage(ErrorMessagesEnum.AuthUserDoesNotExists)));
                }
                else
                {
                    passwordHash = adminUser.PasswordHash;
                    passwordSalt = adminUser.PasswordSalt;
                    adminUser    = _mapper.Map <AdminUser>(adminUserData);
                }

                if (!String.IsNullOrEmpty(adminUserData.Password) && !String.IsNullOrEmpty(adminUserData.ConfirmPassword) && adminUserData.Password == adminUserData.ConfirmPassword)
                {
                    //if(!VerifyPasswordHash(adminUserData.Password, adminUser.PasswordHash, adminUser.PasswordSalt))
                    //{
                    //    _logger.LogInfo(string.Format(_messageHandler.GetMessage(ErrorMessagesEnum.InValidPassword)," Password doesn't match"));
                    //    return new AdminResponse(false, string.Format(_messageHandler.GetMessage(ErrorMessagesEnum.InValidPassword), " Password doesn't match"));
                    //}
                    CreatePasswordHash(adminUserData.Password, out passwordHash, out passwordSalt);
                    _logger.LogInfo("HMACSHA512 password created for password update");
                }
                adminUser.PasswordHash = passwordHash;
                adminUser.PasswordSalt = passwordSalt;
                _adminUserRepo.UpdateAdmin(adminUser);
                _logger.LogInfo("Successfully updated by role " + adminUserData.Role);
                adminUserData.Password        = null;
                adminUserData.ConfirmPassword = null;
                AdminResponse response = new AdminResponse(true, string.Format(_messageHandler.GetSuccessMessage(SuccessMessagesEnum.SuccessfullyUpdated)));
                response.AdminUser = adminUserData;
                return(response);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
                return(new AdminResponse(false, ex.Message));
            }
        }
コード例 #9
0
        public void AddResponse(AdminResponse response, ObjectId messId)
        {
            Message message = GetComment(messId);

            var responsesCollection = db.GetCollection <AdminResponse>("adminresponses");
            var commentsCollection  = db.GetCollection <Message>("messages");

            responsesCollection.InsertOne(response);

            message.Responses.Add(new MongoDBRef("adminresponses", response.Id));

            var update = Builders <Message> .Update.Set("Responses", message.Responses);

            var filter = Builders <Message> .Filter.Eq("_id", messId);

            commentsCollection.UpdateOne(filter, update);
        }
コード例 #10
0
ファイル: PassService.cs プロジェクト: Ashis27/Hiroshima
 public AdminResponse CreatePass(PassInformationViewModel passInformation)
 {
     _logger.LogInfo("Trying to add a new pass");
     try
     {
         //Pass remain active whole day(ex: 10/29/2019 23:59:59)
         passInformation.PassExpiredDate = passInformation.PassExpiredDate.AddDays(1).AddSeconds(-1);
         PassInformation passInfo = _mapper.Map <PassInformationViewModel, PassInformation>(passInformation);
         _passRepository.CreatePass(passInfo);
         _logger.LogInfo("Successfully created a new pass");
         AdminResponse response = new AdminResponse(true, string.Format(_messageHandler.GetSuccessMessage(SuccessMessagesEnum.SuccessfullySaved)));
         response.PassInformation = passInformation;
         return(response);
     }
     catch (Exception ex)
     {
         _logger.LogError(ex.Message);
         return(new AdminResponse(false, ex.Message));
     }
 }
コード例 #11
0
 public AdminResponse AdminRegistration(AdminRequest adminRequest)
 {
     try
     {
         var data = this.dBContext.admins.FirstOrDefault(linq => linq.AdmEmail == adminRequest.AdminEmail);
         if (data != null)
         {
             return(null);
         }
         adminRequest.Password = EncodeDecode.EncodePassword(adminRequest.Password);
         Admin admin = new Admin()
         {
             AdmFirstName     = adminRequest.AdminFirstName,
             AdmLastName      = adminRequest.AdminLastName,
             AdmContactNumber = adminRequest.AdminContactNumber,
             AdmEmail         = adminRequest.AdminEmail,
             Created          = DateTime.Now,
             Modified         = DateTime.Now,
             Password         = adminRequest.Password
         };
         this.dBContext.admins.Add(admin);
         dBContext.SaveChanges();
         if (adminRequest != null)
         {
             AdminResponse adminResponse = new AdminResponse()
             {
                 AdminId            = admin.AdminId,
                 AdminFirstName     = admin.AdmFirstName,
                 AdminLastName      = admin.AdmLastName,
                 AdminContactNumber = admin.AdmContactNumber,
                 AdminEmail         = admin.AdmEmail,
             };
             return(adminResponse);
         }
         return(null);
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
コード例 #12
0
        public AdminResponse AdminLogin(AdminLogin adminLogin)
        {
            AdminResponse adminRegistration = new AdminResponse();

            try
            {
                using (this.connection)
                {
                    var        password = Encryptdata(adminLogin.Password);
                    SqlCommand command  = new SqlCommand("spAdminLogin", this.connection);
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.AddWithValue("@Email", adminLogin.Email);
                    command.Parameters.AddWithValue("@Password", password);
                    this.connection.Open();
                    SqlDataReader dataReader = command.ExecuteReader();
                    if (dataReader.HasRows)
                    {
                        while (dataReader.Read())
                        {
                            adminRegistration.AdminId      = dataReader.GetInt32(0);
                            adminRegistration.FullName     = dataReader.GetString(1);
                            adminRegistration.Email        = dataReader.GetString(2);
                            adminRegistration.Password     = dataReader.GetString(3);
                            adminRegistration.MobileNumber = dataReader.GetString(4);
                            adminRegistration.Role         = dataReader.GetString(5);
                        }
                        return(adminRegistration);
                    }
                }
                return(null);
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                this.connection.Close();
            }
        }
コード例 #13
0
ファイル: PTOService.cs プロジェクト: Ashis27/Hiroshima
 public AdminResponse CreatePTO(PTOInformationViewModel ptoInformation)
 {
     _logger.LogInfo("Trying to add a new PTO");
     try
     {
         if (ptoInformation.PTODescription.Count() == 0)
         {
             throw new Exception(string.Format(_messageHandler.GetMessage(ErrorMessagesEnum.InValidPTODescription)));
         }
         PTOInformation ptoInfo = _mapper.Map <PTOInformation>(ptoInformation);
         _ptoRepository.CreatePTO(ptoInfo);
         _logger.LogInfo("Successfully created a new PTO");
         AdminResponse response = new AdminResponse(true, string.Format(_messageHandler.GetSuccessMessage(SuccessMessagesEnum.SuccessfullySaved)));
         response.PTOInformation = ptoInformation;
         return(response);
     }
     catch (Exception ex)
     {
         _logger.LogError(ex.Message);
         return(new AdminResponse(false, ex.Message));
     }
 }
コード例 #14
0
ファイル: ApiService.cs プロジェクト: AndresCG2019/SAC_VALES
        async Task <Response> IApiService.GetAdminAsync(int id, string urlBase, string servicePrefix, string controller)
        {
            try
            {
                HttpClient client = new HttpClient
                {
                    BaseAddress = new Uri(urlBase),
                };

                string url = $"{servicePrefix}{controller}/{id}";
                HttpResponseMessage response = await client.GetAsync(url);

                string result = await response.Content.ReadAsStringAsync();

                if (!response.IsSuccessStatusCode)
                {
                    return(new Response
                    {
                        IsSuccess = false,
                        Message = result,
                    });
                }

                AdminResponse model = JsonConvert.DeserializeObject <AdminResponse>(result);
                return(new Response
                {
                    IsSuccess = true,
                    Result = model
                });
            }
            catch (Exception ex)
            {
                return(new Response
                {
                    IsSuccess = false,
                    Message = ex.Message
                });
            }
        }
コード例 #15
0
        public async Task <IActionResult> Index(Admin admin)
        {
            //verifiedUser ska användas för att lagra loginAPI response som skickar en bool, och en string[]
            AdminResponse verifiedUser = null;

            try
            {
                using (HttpClient client = new HttpClient())
                {
                    var content = new StringContent(JsonConvert.SerializeObject(admin), Encoding.UTF8, "application/json");

                    //Skickar iväg serialized inmatat username och password till grupp 3 loginAPI
                    using (var response = await client.PostAsync("http://informatik10.ei.hv.se/UserService/Login", content))
                    {
                        string jR = await response.Content.ReadAsStringAsync();

                        //Tar emot och lägger converterade json svaret i en AdminResponse object
                        verifiedUser = JsonConvert.DeserializeObject <AdminResponse>(jR);
                    }
                }
            }
            catch (Exception e)
            {
                logger.LogError("Error fetching API data \n " + e);
            }

            //Om status är true ska den authenticate user
            try
            {
                if (verifiedUser.Status)
                {
                    var identity = new ClaimsIdentity(CookieAuthenticationDefaults.AuthenticationScheme);
                    for (int i = 0; i < verifiedUser.Role.Length; i++)
                    {
                        identity.AddClaim(new Claim(ClaimTypes.Role, verifiedUser.Role[i]));
                    }
                    identity.AddClaim(new Claim(ClaimTypes.Name, admin.Username));


                    await HttpContext.SignInAsync(
                        CookieAuthenticationDefaults.AuthenticationScheme,
                        new ClaimsPrincipal(identity));

                    /*Temp fix: Den redirectar till reservations när man loggar in för jag får
                     * inte den att redirecta vart man klickade innan inloggningssidan */
                    logger.LogInformation("Successful login as user: "******"~/Home/Index/"));
                }
                else
                {
                    //Annars skriver den ut detta
                    logger.LogInformation("Unsuccessful Login attempt. Username field: " + admin.Username);
                    ModelState.AddModelError("", "Inloggning ej godkänd");
                    return(View());
                }
            }
            catch (Exception e)
            {
                logger.LogError("Error trying to verify user for login \n " + e);
                return(View());
            }
        }
コード例 #16
0
 internal override void InternalDeserialize(NetIncomingMessage lidgrenMsg)
 {
     base.InternalDeserialize(lidgrenMsg);
     Response = (AdminResponse)lidgrenMsg.ReadInt32();
 }
コード例 #17
0
        public async Task AddAdminResponse(AdminResponse response)
        {
            await _dataContext.AdminResponces.AddAsync(response);

            await _dataContext.SaveChangesAsync();
        }
コード例 #18
0
ファイル: PassService.cs プロジェクト: Ashis27/Hiroshima
        public async Task <AdminResponse> UpdatePass(PassInformationViewModel passInformation)
        {
            _logger.LogInfo("Trying to update existing pass information");
            try
            {
                _logger.LogInfo("Trying to update existing pass information");
                //Get Existing Pass info based on Pass
                PassInformation passInfo = await this._passRepository.GetActivePass(passInformation.Id);

                //If null then throw exception with invalid information
                if (passInfo == null)
                {
                    return(new AdminResponse(false, string.Format(_messageHandler.GetMessage(ErrorMessagesEnum.InValidPassDescription))));
                }

                PassDescription passDesc = new PassDescription();
                //if null then update only Pass information otherwise update Pass description
                if (passInformation.PassDescription != null && passInformation.PassDescription.Count() > 0)
                {
                    //Get Existing Pass desc based on Pass desc id
                    passDesc = passInfo.PassDescription?.Where(p => p.Id == passInformation.PassDescription.FirstOrDefault().Id&& p.SelectedLanguage == passInformation.PassDescription.FirstOrDefault().SelectedLanguage&& p.IsActive).FirstOrDefault();

                    //Pass remain active whole day(ex: 10/29/2019 23:59:59)
                    passInformation.PassExpiredDate = passInformation.PassExpiredDate.AddDays(1).AddSeconds(-1);

                    ////mapped view model to entity
                    passInfo = _mapper.Map <PassInformation>(passInformation);

                    //If null then add new Pass desc with selected language otherwise update existing Pass desc.
                    if (passDesc != null)
                    {
                        //update existing entity from edited by user
                        passDesc = passInfo.PassDescription.FirstOrDefault();

                        //Updated Pass information
                        _passRepository.UpdatePass(passInfo);
                        _logger.LogInfo("Successfully updated Pass information");

                        //Updated pass description
                        _passDescriptionRepository.UpdatePassDesc(passDesc);
                        _logger.LogInfo("Successfully updated Pass Description information");

                        //If selected Pass has already been added then remove all assigned pass along with PTO information from mapper table
                        _passActivePTOMapper.BulkDeletePass(passInfo.Id);
                        _logger.LogInfo("Removed all assigned PTOs with Pass information from mapper table");

                        //Add new updated PTOs for a pass information in Mapper table
                        _passActivePTOMapper.BulkAddPTO(passInfo.PassActivePTOs.ToArray());
                        _logger.LogInfo("Successfully added PTOs information in mapper table");
                    }
                    else
                    {
                        //Added new Pass description if new language selected by user
                        _passDescriptionRepository.AddPassDesc(passInfo.PassDescription.FirstOrDefault());
                        _logger.LogInfo("Successfully added Pass description information");
                    }
                }
                else
                {
                    return(new AdminResponse(false, string.Format(_messageHandler.GetMessage(ErrorMessagesEnum.InValidPassDescription))));
                }

                AdminResponse response = new AdminResponse(true, "Successfully saved");
                response.PassInformation = passInformation;
                return(response);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
                return(new AdminResponse(false, ex.Message));
            }
        }
コード例 #19
0
        public async Task <IActionResult> SolveRefund(Guid refundRequestId, [FromBody] RefundSolutionDto solution)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var request = _usersRepository.GetRefundRequest(refundRequestId);

            if (request == null)
            {
                return(NotFound());
            }

            var history = await _tripsRepository.GetTripHistory(request.TripHistoryId);

            if (history == null)
            {
                return(NotFound());
            }
            var user = _usersRepository.GetCustomerById(history.CustomerId);
            var root = (await _usersRepository.GetUsers(new UserResourceParameters()
            {
                Rol = Helpers.Constants.Strings.JwtClaims.RootUserAccess
            })).FirstOrDefault();

            if (solution.ToRefund == true)
            {
                var res = Refund.Approve((ulong)history.ContractId, new DefaultControllerPattern(),
                                         new User()
                {
                    PrivateKey = root.PrivateKey
                }, ModelState);
            }
            else
            {
                var res = Refund.DisApprove((ulong)history.ContractId, new DefaultControllerPattern(),
                                            new User()
                {
                    PrivateKey = root.PrivateKey
                }, ModelState);
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var adminid = User.Claims.FirstOrDefault(c => c.Type == Helpers.Constants.Strings.JwtClaimIdentifiers.AdminId)?.Value;

            request.Solved = true;

            request.Message += ("\n " + solution.Message);

            _usersRepository.UpdateRefund(request);

            var responce = new AdminResponse()
            {
                AdminId      = Guid.Parse(adminid),
                CreationTime = DateTime.UtcNow,
                IdentityId   = user.Identity.Id,
                Message      = solution.Message
            };

            await _usersRepository.AddAdminResponse(responce);

            return(NoContent());
        }
コード例 #20
0
        public AdminResponse updateEvent()
        {
            //var file = HttpContext.Current.Request.Files.Count > 0 ?
            //  HttpContext.Current.Request.Files[0] : null;


            var httpContext = Request.Form["Address"];

            //if (file != null && file.ContentLength > 0)
            //{
            //    var fileName = Path.GetFileName(file.FileName);

            //    var path = Path.Combine(HttpContext.Current.Server.MapPath("~/uploads"), fileName);
            //}

            //HttpPostedFileBase _HttpPostedFileBase= null;

            //if (data.userfile != null)
            //{
            //    _HttpPostedFileBase =(HttpPostedFileBase)data.userfile;
            //}

            AdminResponse _AdminResponse = new AdminResponse();

            //try
            //{

            //    Models.Artists _Artists = null;
            //    GenericRepository<Artists> _ArtistsRepo = new GenericRepository<Artists>(_unitOfWork);


            //    int ArtistID = Numerics.GetInt(data.ArtistID);
            //    _Artists = _ArtistsRepo.Repository.Get(p => p.ArtistID == ArtistID);

            //    if (_Artists != null)
            //    {
            //        _Artists.ArtistName = (data.ArtistName != null) ? data.ArtistName.ToString() != "" ? data.ArtistName : _Artists.ArtistName : _Artists.ArtistName;
            //        _Artists.Musicgraph_ID = (data.Musicgraph_ID != null) ? data.Musicgraph_ID.ToString() != "" ? data.Musicgraph_ID : _Artists.Musicgraph_ID : _Artists.Musicgraph_ID;
            //        _Artists.About = (data.About != null) ? data.About.ToString() != "" ? data.About : _Artists.About : _Artists.About;
            //        _Artists.Spotify_ID = (data.Spotify_ID != null) ? data.Spotify_ID.ToString() != "" ? data.Spotify_ID : _Artists.Spotify_ID : _Artists.Spotify_ID;
            //        _Artists.Instagram_ID = (data.Instagram_ID != null) ? data.Instagram_ID.ToString() != "" ? data.Instagram_ID : _Artists.Instagram_ID : _Artists.Instagram_ID;
            //        _Artists.OnTour = (data.OnTour != null) ? data.OnTour.ToString() != "" ? data.OnTour : _Artists.OnTour : _Artists.OnTour;


            //        _ArtistsRepo.Repository.Update(_Artists);

            //    _AdminResponse.Status = true;
            //    _AdminResponse.RetMessage = "Artist updated successfully.";
            //    return _AdminResponse;
            //}
            //else
            //{
            //    _AdminResponse.Status = false;
            //    _AdminResponse.RetMessage = "Invalid Artist";
            //    return _AdminResponse;
            //}


            //}
            //catch (Exception ex)
            //{
            _AdminResponse.Status = false;
            // _AdminResponse.RetMessage = ex.Message;
            return(_AdminResponse);

            //}
        }