The base response model with data api responses
Inheritance: ResponseModel, IResponse
Beispiel #1
0
        public JsonResult BeforeLoginUserProjectDetailsService()
        {            
            string totalProjects = "152";
            string successRate = "94.2";
            string totalUsers = "3854";
            string projectCategories = "37";
            var response = new ResponseModel<BeforeLoginUserProjectDetailsModel>();
            response.Status = 200;
            BeforeLoginUserProjectDetailsModel beforeLoginUserProjectDetailsServiceDataModelService;
            response.Message = "success";
            try
            {
                beforeLoginUserProjectDetailsServiceDataModelService = new BeforeLoginUserProjectDetailsModel
                {
                    TotalUsers = _db.Users.Count().ToString(CultureInfo.InvariantCulture),
                    TotalProjects = new ProjectDAO().totalAvailableProjects(),
                    SuccessRate = "94.3",
                    ProjectCategories = "35"
                };
            }
            catch (DbEntityValidationException e)
            {
                DbContextException.LogDbContextException(e);
                response.Status = 500;
                response.Message = "Internal Server Error !!!";
                return Json(response, JsonRequestBehavior.AllowGet);
            }

            response.Payload = beforeLoginUserProjectDetailsServiceDataModelService;
            return Json(response, JsonRequestBehavior.AllowGet);
        }
Beispiel #2
0
        public ResponseModel<ClientDetailsModel> GetClientDetails(string username)
        {
            var response = new ResponseModel<ClientDetailsModel>();

            try
            {
                var clientDetailDbResult = _db.Users.SingleOrDefault(x => x.Username == username);
                if (clientDetailDbResult != null)
                {
                    var createClientDetailResponse = new ClientDetailsModel
                    {
                        FirstName = clientDetailDbResult.FirstName,
                        LastName = clientDetailDbResult.LastName,
                        Username = clientDetailDbResult.Username
                    };
                    response.Status = 200;
                    response.Message = "success";
                    response.Payload = createClientDetailResponse;
                }
                else
                {
                    response.Status = 404;
                    response.Message = "username not found";
                }
            }
            catch (Exception)
            {
                response.Status = 500;
                response.Message = "exception occured !!!";
            }
            return response;
        }
Beispiel #3
0
 public JsonResult LockUserAccount()
 {
     var response = new ResponseModel<LoginResponse>();
     var headers = new HeaderManager(Request);
     M2ESession session = TokenManager.getSessionInfo(headers.AuthToken, headers);
     var isValidToken = TokenManager.IsValidSession(headers.AuthToken);
     response = new AuthService().LockAccountService(headers, session);
     return Json(response);
 }
Beispiel #4
0
 public JsonResult UnlockAccount(string pass)
 {
     var response = new ResponseModel<LoginResponse>();
     var headers = new HeaderManager(Request);
     M2ESession session = TokenManager.getSessionInfo(headers.AuthToken, headers);
     var isValidToken = TokenManager.IsValidSession(headers.AuthToken);
     response = new AuthService().unlockAccountService(headers, session,EncryptionClass.Md5Hash(pass));
     return Json(response);
 }
Beispiel #5
0
 public ResponseManager(string responseData)
 {
     try
     {
         _dataModel = DataModel<ResponseModel>.FromString(responseData);
         _parsingSuccessful = true;
     }
     catch { }
 }
Beispiel #6
0
        public ResponseModel<String> ValidateAccountService(ValidateAccountRequest req)
        {
            var response = new ResponseModel<string>();
            if (_db.ValidateUserKeys.Any(x => x.Username == req.userName && x.guid == req.guid))
            {
                var user = _db.Users.SingleOrDefault(x => x.Username == req.userName);
                if (user == null)
                {
                    response.Status = 500;
                    response.Message = "Internal Server Error";
                    Logger.Info("Validate Account : " + req.userName);
                    return response;
                }
                if (user.isActive == "true")
                {
                    response.Status = 405;
                    response.Message = "already active user";
                    return response;
                }
                user.isActive = "true";
                var Recommendations = _db.RecommendedBies.SingleOrDefault(x => x.RecommendedTo == user.Username);
                
                new UserMessageService().SendUserNotificationForAccountVerificationSuccess(
                            user.Username, user.Type
                        );

                if (Recommendations != null)
                {
                    Recommendations.isValid = Constants.status_true;
                    var result = new UserReputationService().UpdateUserBalance(Constants.userType_user, Recommendations.RecommendedFromUsername,
                            Constants.newAccountCreationReferralBalanceAmount, 0, 0, Constants.payment_credit, Recommendations.RecommendedTo + " Joined Cautom", "New Account",
                            "Referral Bonus", false);
                    new UserNotificationService().SendUserCommonNotificationAsync(Recommendations.RecommendedFromUsername,Recommendations.RecommendedTo +" Account Validated <br/> Referral Bonus is Credited to your account!",Constants.userType_user);
                }
                    
                try
                {
                    _db.SaveChanges();
                }
                catch (DbEntityValidationException e)
                {
                    DbContextException.LogDbContextException(e);
                    response.Status = 500;
                    response.Message = "Internal Server Error";
                    return response;
                }
                response.Status = 200;
                response.Message = "validated";
                return response;
            }
            response.Status = 402;
            response.Message = "link expired";
            return response;
        }
 public SysException(Enum code, string msg, HttpStatusCode statusCode = HttpStatusCode.BadRequest)
     : base(statusCode)
 {
     var error = new ResponseModel<string>()
         {
             url = HttpContext.Current.Request.Url.AbsoluteUri,
             code = code,
             msg = code.ToString(),
             result = msg
         };
     Response.Content = new StringContent(JsonSerializerHelper.Serialize(error));
 }
Beispiel #8
0
        public ResponseModel<string> CreateTemplate(List<CreateTemplateQuestionInfoModel> req,string username)
        {
            var response = new ResponseModel<string>();

            var keyInfo = _db.CreateTemplateQuestionInfoes.FirstOrDefault();
            var refKey = username;
            var digitKey = 0;
            if (keyInfo != null)
            {
                digitKey = _db.CreateTemplateQuestionInfoes.Max(x => x.Id) + 1;
            }
            else
            {
                digitKey = 1;
            }
            refKey += digitKey;
            var createTemplateQuestionsInfoInsert = new CreateTemplateQuestionInfo
            {
                buttonText = "NA",
                username = username,
                title = req[0].title,
                visible = "NA",
                type = "NA",
                creationTime = DateTime.Now.ToString(CultureInfo.InvariantCulture),
                referenceId = refKey,
                total = "NA",
                completed = "NA",
                verified = "NA"
            };

            _db.CreateTemplateQuestionInfoes.Add(createTemplateQuestionsInfoInsert);

            try
            {
                _db.SaveChanges();
                CreateSubTemplateByRefKey CreateSubTemplateByRefKey = new CreateSubTemplateByRefKey();
                CreateSubTemplateByRefKey.CreateSubTemplateByRefKeyService(req, username, refKey);
                response.Status = 200;
                response.Message = "success-"+digitKey;
                response.Payload = refKey;
            }
            catch (DbEntityValidationException e)
            {
                DbContextException.LogDbContextException(e);
                response.Status = 500;
                response.Message = "Failed";
                response.Payload = "Exception Occured";
            }

            return response;
        }
        internal static ResponseModel<List<Data.Product>> GetCategoryBrandModelWithLimit(string category, int start,string brand, string subcategory)
        {
            List<Data.Product> rawProducts = new List<Data.Product>();
            ResponseModel<List<Data.Product>> response = new ResponseModel<List<Data.Product>>();

            if (Constants.HelperClasses.ConstantValidator.IsValidCategory(category))
            {
                rawProducts = MappingSearch.Data.Accessors.ProductsAccessor.GetFilteredProducts(category,brand,subcategory);
            }
            response.PageCount = (rawProducts.Count() + MAX_PRODUCTS - 1) / MAX_PRODUCTS;
               var take = rawProducts.Count > MAX_PRODUCTS + start ? MAX_PRODUCTS : rawProducts.Count - start;
            response.Model =  rawProducts.Skip(start).Take(take).Select(x => x).ToList();
            return response;
        }
        public async Task Post()
        {
            ValuesAPIClient valuesApi = new ValuesAPIClient(MediaType.json);

            ResponseModel result = new ResponseModel();
            result.Message = "111";
            var result2 = valuesApi.Post<ResponseModel, ResponseModel>("api/Values/Post", result);

            Assert.AreEqual(result2.Message.Substring(0, 3), "111");
            await valuesApi.PostAsync<ResponseModel, ResponseModel>("api/Values/Post", result);

            valuesApi.Invoke<ResponseModel, ResponseModel>("api/Values/Post", result, httpMethod: HttpMethod.Post);
            await valuesApi.InvokeAsync<ResponseModel, ResponseModel>("api/Values/Post", result, httpMethod: HttpMethod.Post);
        }
Beispiel #11
0
 public ResponseModel<String> ForgetPasswordService(string id, HttpRequestBase request)
 {
     var response = new ResponseModel<string>();
     if (_db.Users.Any(x => x.Username == id))
     {
         var user = _db.Users.SingleOrDefault(x => x.Username == id);
         if (user != null && (user.isActive.Equals("false",StringComparison.InvariantCulture)))
         {
             // User account has not validated yet
             response.Status = 402;
             response.Message = "warning";
             return response;
         }
         var forgetPasswordDataAlreadyExists = _db.ForgetPasswords.SingleOrDefault(x => x.Username == id);
         if (forgetPasswordDataAlreadyExists != null)
             _db.ForgetPasswords.Remove(forgetPasswordDataAlreadyExists);
         var guid = Guid.NewGuid().ToString();
         var forgetPasswordData = new ForgetPassword
         {
             Username = id,
             guid = guid
         };
         _db.ForgetPasswords.Add(forgetPasswordData);
         try
         {
             _db.SaveChanges();
             var forgetPasswordValidationEmail = new ForgetPasswordValidationEmail();
             forgetPasswordValidationEmail.SendForgetPasswordValidationEmailMessage(id, guid, request, DateTime.Now.Ticks.ToString(CultureInfo.InvariantCulture));
         }
         catch (DbEntityValidationException e)
         {
             DbContextException.LogDbContextException(e);
             response.Status = 500;
             response.Message = "Internal Server Error";
             return response;
         }
     }
     else
     {
         // User doesn't exist
         response.Status = 404;
         response.Message = "warning";
         return response;
     }
         response.Status = 200;
         response.Message = "Success";
         return response;
 }
        internal static ResponseModel<List<Location>> FindLocationsInDistance(string zip, int distance, int start,int end)
        {
            GoogleGeoCodeResponse coord = GetLatLongOfZip(zip);
            List<Location> allLocations = Data.Accessors.TracksAccessor.GetAllTracks();
            List<Location> filteredLocations;
            if (coord.results.Length > 0)
                filteredLocations = FilterLocationsFromList(allLocations, distance, Convert.ToDouble(coord.results[0].geometry.location.lat),Convert.ToDouble(coord.results[0].geometry.location.lng)).OrderBy(x=>x.Name).ToList();
            else
                filteredLocations = new List<Location>();

            ResponseModel<List<Location>> response = new ResponseModel<List<Location>>();
            response.PageCount = filteredLocations.Count() / PageCountConstants.MAX_TRACKS;
            end = filteredLocations.Count > end ? end : filteredLocations.Count;
            response.Model = filteredLocations.Skip(start).Take(end).Select(x => x).ToList();
            return response;
        }
        internal static ResponseModel<List<ReviewViewModel>> GetAllTrackReviewsForPage(int id, int start, int end, string sortMethod)
        {
            ResponseModel<List<ReviewViewModel>> response = new ResponseModel<List<ReviewViewModel>>();
            List<ReviewViewModel> rawReviews = new List<ReviewViewModel>();
            //validate sortMethod

            rawReviews = MappingSearch.Data.Accessors.ReviewsAccessor.GetAllTrackReviewsForPage(id);
            end = rawReviews.Count > end ? end : rawReviews.Count;
            var rawReviewsquery =  rawReviews.Skip(start).Take(end).Select(x => x);
            if(String.IsNullOrEmpty(sortMethod) || String.Equals("date",sortMethod))
            {
                rawReviews = rawReviewsquery.OrderBy(x => x.PostedDate).Reverse().ToList();
            }
            response.Model = rawReviews;
            return response;
        }
Beispiel #14
0
        public ResponseModel<LoginResponse> LockAccountService(HeaderManager headers, M2ESession session)
        {
            var response = new ResponseModel<LoginResponse>();
            if (session.UserName != null)
            {
                bool logoutStatus = new TokenManager().Logout(headers.AuthToken);
                var user = _db.Users.SingleOrDefault(x => x.Username == session.UserName);
                if (user != null)
                {                                        
                    var data = new Dictionary<string, string>();
                    data["Username"] = user.Username;
                    data["Password"] = user.Password;
                    data["userGuid"] = user.guid;

                    var encryptedData = EncryptionClass.encryptUserDetails(data);

                    response.Payload = new LoginResponse();
                    response.Payload.UTMZK = encryptedData["UTMZK"];
                    response.Payload.UTMZV = encryptedData["UTMZV"];
                    response.Payload.TimeStamp = DateTime.Now.ToString(CultureInfo.InvariantCulture);
                    response.Payload.Code = "200";
                    response.Status = 200;
                    response.Message = "Account Locked";

                    var newUserSession = new M2ESession(user.Username);
                    TokenManager.CreateSession(newUserSession);
                    response.Payload.UTMZT = newUserSession.SessionId;
                    user.Locked = Constants.status_true;

                    try
                    {
                        _db.SaveChanges();
                    }
                    catch (DbEntityValidationException e)
                    {
                        DbContextException.LogDbContextException(e);                        
                    }
                }
                else
                {
                    response.Status = 424;
                    response.Message = "user detail not available";
                }
            }
                        
            return response;
        }
Beispiel #15
0
        public ResponseModel RegisterUser(SignUpRequestModel input)
        {
            var response = new ResponseModel();

            if (!this.ModelState.IsValid)
            {
                response.Status = new Status
                {
                    Code = Status.INTERNAL_MESSAGE_CODE,
                    Message = this.ModelState.Values.First().Errors.First().ErrorMessage
                };

                return response;
            }

            if (input == null)
            {
                response.Status = Status.MISSING_PARRAMETERS;
                return response;
            }

            ////check for exist user in db by email
            var existUser = this.Users.SingleOrDefault(a => a.Email == input.Email);
            if (existUser != null)
            {
                response.Status = Status.SIGNUP_HAS_ACCOUNT_YET;
                return response;
            }

            this.Users.Add(new User
            {
                FirstName = input.FirstName,
                LastName = input.LastName,
                Email = input.Email,
                Phone = input.Phone,
                FanApps = input.FanApp,
                Gender = input.Gender,
                City = input.City,
                Address = input.Address,
                CreateDatetime = DateTime.Now,
                Token = AuthenticationUtil.Encrypt(input.Password)
            });

            response.Status = Status.SIGNUP_SUCCESS;
            return response;
        }
Beispiel #16
0
 public ResponseModel<String> ResendValidationCodeService(ValidateAccountRequest req, HttpRequestBase request)
 {
     var response = new ResponseModel<string>();
     if (_db.Users.Any(x => x.Username == req.userName))
     {
         var user = _db.Users.SingleOrDefault(x => x.Username == req.userName);
         if (user != null && (user.isActive == "true"))
         {
             // Account has been already validated.
             response.Status = 402;
             response.Message = "warning";
             return response;
         }
         var guidAlreadyExist = _db.ValidateUserKeys.SingleOrDefault(x => x.Username == req.userName);
         if (guidAlreadyExist != null)
         {
             _db.ValidateUserKeys.Remove(guidAlreadyExist);
         }
         var dbValidateUserKey = new ValidateUserKey
         {
             guid = Guid.NewGuid().ToString(),
             Username = req.userName
         };
         _db.ValidateUserKeys.Add(dbValidateUserKey);
         try
         {
             _db.SaveChanges();
             SendAccountCreationValidationEmail.SendAccountCreationValidationEmailMessage(req.userName, dbValidateUserKey.guid, request);
         }
         catch (DbEntityValidationException e)
         {
             DbContextException.LogDbContextException(e);
             response.Status = 500;
             response.Message = "Internal Server Error !!!";
             return response;
         }
         response.Status = 200;
         response.Message = "success";
         return response;
     }
     // User Doesn't Exist
     response.Status = 404;
     response.Message = "warning";
     return response;
 }
        public JsonResult FacebookLoginMobileApi()
        {
            var response = new ResponseModel<LoginResponse>();
            String fid = Request.QueryString["fid"];
            String access_token = Request.QueryString["accessToken"];            
            try
            {                
                response = new SocialAuthService().CheckAndSaveFacebookUserInfoIntoDatabase(fid, Constants.NA,access_token,true);                
            }
            catch (DbEntityValidationException e)
            {
                DbContextException.LogDbContextException(e);
                response.Status = 500;
                response.Message = "Failed";
            }

            return Json(response, JsonRequestBehavior.AllowGet);
        }
        public ResponseModel Get()
        {
            //DomainModel db = new DomainModel();
            List<Basic_Information> students;
            using (var db = new DomainModel())
            {
                students = db.Basic_Information.ToList();
                //students = db.Basic_Information.ToList();
            }
            ResponseModel response = new ResponseModel()
            {
                Issucces = true,
                Message = "Data",
                Data = students
            };

            return response;
        }
        public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
        {
            //System.Net.Http.ObjectContent
                object a;
                if (null == actionExecutedContext.Response.Content)
                {
                    ResponseModel<string> rm = new ResponseModel<string>(null);
                    actionExecutedContext.Response = actionExecutedContext.Request.CreateResponse(
                        HttpStatusCode.OK,
                       rm);
                }
                else if (!actionExecutedContext.Response.IsSuccessStatusCode)
                {
                    JToken j = actionExecutedContext.Response.Content.ReadAsAsync<JToken>().Result;

                    ResponseModel<JToken> rm = new ResponseModel<JToken>(j);
                    rm.statusCode = ResponseModelCode.Unknown;
                    rm.message = actionExecutedContext.Response.ReasonPhrase ;
                    actionExecutedContext.Response = actionExecutedContext.Request.CreateResponse(
                        HttpStatusCode.OK,
                       rm);

                }
                else if (actionExecutedContext.Response.TryGetContentValue<object>(out a))
                {
                    ResponseModel<object> rm = new ResponseModel<object>(a);
                    actionExecutedContext.Response = actionExecutedContext.Request.CreateResponse(
                        HttpStatusCode.OK,
                       rm);
                }
                else
                {
                    JToken j = actionExecutedContext.Response.Content.ReadAsAsync<JToken>().Result;

                    ResponseModel<JToken> rm = new ResponseModel<JToken>(j);
                    actionExecutedContext.Response = actionExecutedContext.Request.CreateResponse(
                        HttpStatusCode.OK,
                       rm);
                }

                //json序列化
                new JsonCallbackAttribute().OnActionExecuted(actionExecutedContext);
        }
Beispiel #20
0
 public JsonResult GetAllTemplateInformation()
 {
     //var username = "******";            
     var headers = new HeaderManager(Request);
     M2ESession session = TokenManager.getSessionInfo(headers.AuthToken, headers);
     var clientTemplate = new ClientTemplateService();
     var isValidToken= TokenManager.IsValidSession(headers.AuthToken);
     if (isValidToken)
     {
         return Json(clientTemplate.GetAllTemplateInformation(session.UserName));
     }
     else
     {
         ResponseModel<string> response = new ResponseModel<string>();
         response.Status = 401;
         response.Message = "Unauthorized";
         return Json(response);
     }
 }
        public ResponseModel<UserProductSurveyTemplateModel> GetTemplateInformationByRefKey(string username,string refKey)
        {
            var response = new ResponseModel<UserProductSurveyTemplateModel>();
            var job = _db.CreateTemplateQuestionInfoes.SingleOrDefault(x=>x.referenceId == refKey);
            response.Status = 200;
            response.Message = "success";
            response.Payload = new UserProductSurveyTemplateModel();
            try
            {
                string earningPerThreadTemp = Convert.ToString(Convert.ToDouble(job.payPerUser) *(Convert.ToDouble(ConfigurationManager.AppSettings["dollarToRupeesValue"])));
                string remainingThreadsTemp = string.Empty;
                if ((job.type == Constants.type_dataEntry && job.subType == Constants.subType_Transcription)||
                        (job.type == Constants.type_moderation && job.subType == Constants.subType_moderatingPhotos))
                    remainingThreadsTemp = Convert.ToString(Convert.ToInt32(job.totalThreads) - _db.UserMultipleJobMappings.Where(x => x.refKey == job.referenceId && x.isFirst==Constants.status_true).Count());
                else
                    remainingThreadsTemp = Convert.ToString(Convert.ToInt32(job.totalThreads) - _db.UserJobMappings.Where(x => x.refKey == job.referenceId).Count());
                    
                var userTemplate = new UserProductSurveyTemplateModel
                    {
                        title = job.title,
                        type = job.type,
                        subType = job.subType,
                        refKey = job.referenceId,
                        creationTime = job.creationTime,
                        earningPerThreads = earningPerThreadTemp,
                        currency = "INR", // hard coded currency
                        totalThreads = job.totalThreads, // currently hard coded.
                        remainingThreads = remainingThreadsTemp
                    };
                    response.Payload =userTemplate;
                

                return response;
            }
            catch (Exception)
            {
                response.Status = 500;//some error occured
                response.Message = "failed";
                return response;
            }

        }
Beispiel #22
0
        public JsonResult Login(LoginRequest req)
        {
            var returnUrl = "/";
            var referral = Request.QueryString["ref"];
            var responseData = new LoginResponse();
            if (req.Type == "web")
            {
                var loginService = new LoginService();
                responseData = loginService.WebLogin(req.UserName, EncryptionClass.Md5Hash(req.Password), returnUrl, req.KeepMeSignedInCheckBox);
            }

            if (responseData.Code == "200")
            {
                var session = new M2ESession(req.UserName);
                TokenManager.CreateSession(session);
                responseData.UTMZT = session.SessionId;
            }
            var response = new ResponseModel<LoginResponse> { Status = Convert.ToInt32(responseData.Code), Message = "success", Payload = responseData };
            return Json(response);
        }
        public ResponseModel Get(int? GID)
        {
            //DomainModel db = new DomainModel();
            List<MatchDetail> matchdeatils;
            using (var db = new CricketMatchModel())
            {
                var count=db.MatchDetails.Where(x=>x.GID==GID).Sum(x=>x.Score);
                ResponseModel response = new ResponseModel()
                {
                    Issucces = true,
                    Message = "Data",
                    Data = count
                };


                return response;
            }


        }
 public ResponseModel<List<UserAlerts>> GetAllNotification(string username, string userType)
 {
     var response = new ResponseModel<List<UserAlerts>>();
     try
     {
         response.Payload =
             _db.UserAlerts.Where(x => x.messageTo == username && x.userType == userType)
                 .OrderByDescending(x => x.dateTime)
                 .ToList();
         response.Message = "success";
         response.Status = 200;
         return response;
     }
     catch (Exception ex)
     {
         Logger.Error("GetAllNotificationMessage", ex);
         response.Message = "Internal server Error !!";
         response.Status = 500;
         return response;
     }
 }
Beispiel #25
0
        public ResponseModel<UserTranscriptionTemplateModel> GetTranscriptionTemplateInformationByRefKey(string username, string refKey)
        {
            var response = new ResponseModel<UserTranscriptionTemplateModel>();            
            try
            {
                var TranscriptionJobInfo = _db.CreateTemplateQuestionInfoes.SingleOrDefault(x=>x.referenceId == refKey);
                var TranscriptionJobOptions = _db.CreateTemplateTextBoxQuestionsLists.SingleOrDefault(x=>x.referenceKey == refKey);
                var UserMultipleJobMapping = _db.UserMultipleJobMappings.SingleOrDefault(x=>x.refKey == refKey && x.username == username);
                if(UserMultipleJobMapping != null)
                {
                    var TranscriptionImage = _db.CreateTemplateImgurImagesLists.SingleOrDefault(x => x.referenceKey == refKey && x.imgurLink == UserMultipleJobMapping.imageKey);
                    if (TranscriptionJobInfo != null && TranscriptionJobOptions != null && TranscriptionImage != null)
                    {
                        var UserTranscriptionTemplateModel = new UserTranscriptionTemplateModel();
                        UserTranscriptionTemplateModel.type = TranscriptionJobInfo.type;
                        UserTranscriptionTemplateModel.subType = TranscriptionJobInfo.subType;
                        UserTranscriptionTemplateModel.description = TranscriptionJobInfo.description;
                        UserTranscriptionTemplateModel.options = TranscriptionJobOptions.Question; // currently using same question table for transcription.
                        UserTranscriptionTemplateModel.title = TranscriptionJobInfo.title;
                        UserTranscriptionTemplateModel.refKey = TranscriptionJobInfo.referenceId;
                        UserTranscriptionTemplateModel.imageUrl = TranscriptionImage.imgurLink;
                        //UserTranscriptionTemplateModel.uniqueId = Convert.ToString(TranscriptionAllocatedThreadInfo.Id);
                        response.Status = 200;
                        response.Message = "success";
                        response.Payload = UserTranscriptionTemplateModel;
                    }
                }
                                  
                return response;
            }
            catch (Exception ex)
            {
                response.Status = 500;//some error occured
                response.Message = "failed";
                return response;
            }

        }
Beispiel #26
0
        public ResponseModel AddCard(CardModel cardModel)
        {
            var response = new ResponseModel();

            if (!cardModel.Valid())
            {
                return new ResponseModel("Add card model is not valid.");
            }

            User user = _db.Get<User>(cardModel.UserId);

            Card card = new Card();
            card.Title = cardModel.Title;
            card.Description = cardModel.Description;
            card.PeopleCount = cardModel.PeopleCount;
            card.Language = cardModel.Language;
            card._User = new User()
            {
                ID = user.ID,
                FirstName = user.FirstName,
                LastName = user.LastName
            };

            card.Location = new LocationModel()
            {
                Country = cardModel.Country,
                City = cardModel.City
            };

            card.History = new List<History>();
            History history = _history.GetCardHistory(user, CardHistoryType.NewCardAdded);
            card.History.Add(history);

            _db.Add(card);

            return response;
        }
        public JsonResult userMapping()
        {
            var response = new ResponseModel<LoginResponse>();

            String fid = Request.QueryString["fid"];
            String refKey = Request.QueryString["refKey"];
            var headers = new HeaderManager(Request);
            if (headers.AuthToken != null)
            {
                M2ESession session = TokenManager.getSessionInfo(headers.AuthToken, headers);
                var isValidToken = TokenManager.IsValidSession(headers.AuthToken);
                if (isValidToken)
                {
                    var facebookUserMap = _db.FacebookAuths.SingleOrDefault(x => x.facebookId == fid);
                    facebookUserMap.username = session.UserName;
                    try
                    {
                        _db.SaveChanges();
                        response.Status = 209;
                        response.Message = "success-";
                    }
                    catch (DbEntityValidationException e)
                    {
                        DbContextException.LogDbContextException(e);
                        response.Status = 500;
                        response.Message = "Failed";
                    }
                }
            }
            else
            {
                //TODO:need to call method socialauthservice
                response = new SocialAuthService().CheckAndSaveFacebookUserInfoIntoDatabase(fid, refKey,Constants.NA,false);
            }
            
            return Json(response, JsonRequestBehavior.AllowGet);
        }
        public ResponseModel Post(string[] ids)
        {
            DomainModel db = new DomainModel();
            int[] id = null;
            if (ids != null)
            {
                id = new int[ids.Length];
                int j = 0;
                foreach (string i in ids)
                {
                    int.TryParse(i, out id[j++]);
                }
            }

            if (id != null && id.Length > 0)
            {
                List<Department> allSelected = new List<Department>();
                using (DomainModel dc = new DomainModel())
                {
                    allSelected = dc.Departments.Where(a => id.Contains(a.Id)).ToList();
                    foreach (var i in allSelected)
                    {
                        dc.Departments.Remove(i);
                    }
                    dc.SaveChanges();
                }
            }
            ResponseModel response1 = new ResponseModel()
            {

                Issucces = true,
                Message = "Data Delete"

            };
            return response1;
        }
        public override void OnException(HttpActionExecutedContext actionExecutedContext)
        {
            //Logger.Error(actionExecutedContext.Exception);
            //actionExecutedContext.ActionContext.ModelState.

            ResponseModel<string> rm;
            if (actionExecutedContext.Exception is WebApiHandleException)
            {
                WebApiHandleException ex=actionExecutedContext.Exception as WebApiHandleException;
                rm = new ResponseModel<string>(ex.statusCode, ex.Message);
            }
            else
            {
              rm = new ResponseModel<string>(ResponseModelCode.InternalServerError,actionExecutedContext.Exception.Message);

            }

            actionExecutedContext.Response = actionExecutedContext.Request.CreateResponse(
                HttpStatusCode.OK,
               rm);
            //json序列化
            new JsonCallbackAttribute().OnActionExecuted(actionExecutedContext);
            //actionExecutedContext.Response = actionExecutedContext.Request.CreateResponse<string>(HttpStatusCode.OK, null);
        }
Beispiel #30
0
        public async Task <ResponseModel <PaymentDto> > Handle(UpdatePaymentProcess request, CancellationToken cancellationToken)
        {
            var ResponseModel = new ResponseModel <PaymentDto>();
            var item          = await _dbcheapcontext.Payments.FirstOrDefaultAsync(x => x.Amount == request.Amount);

            var expensive = await _dbexpensivecontext.Payments.FirstOrDefaultAsync(x => x.Amount == request.Amount);

            var premium = await _dbpremiumcontext.Payments.FirstOrDefaultAsync(x => x.Amount == request.Amount);


            if (item == null || expensive == null || premium == null)
            {
                var payment = new Payments()
                {
                    Id = request.Id,
                    CreditCardNumber = request.CreditCardNumber,
                    CardHolder       = request.CardHolder,
                    Amount           = request.Amount,
                    ExpirationDate   = request.ExpirationDate
                };
                if (request.Amount < 21)
                {
                    _dbcheapcontext.Payments.Update(payment);
                }
                if (request.Amount > 21 || request.Amount < 500)
                {
                    _dbexpensivecontext.Payments.Update(payment);
                }
                if (request.Amount > 500)
                {
                    _dbpremiumcontext.Payments.Update(payment);
                }
                await _dbcheapcontext.SaveChangesAsync();

                await _dbexpensivecontext.SaveChangesAsync();

                await _dbpremiumcontext.SaveChangesAsync();

                ResponseModel.IsSuccessResponse = true;
                ResponseModel.Message           = "Payment is Processed";
                ResponseModel.ResponseCode      = (int)PaymentEnum.Processed;
                ResponseModel.Result            = new PaymentDto()
                {
                    Id               = request.Id,
                    CardHolder       = request.CardHolder,
                    CreditCardNumber = request.CreditCardNumber,
                    Amount           = request.Amount,
                    SecurityCode     = request.SecurityCode,
                    ExpirationDate   = request.ExpirationDate
                };
                return(ResponseModel);
            }
            else
            {
                ResponseModel.Result            = null;
                ResponseModel.IsSuccessResponse = false;
                ResponseModel.Message           = "Request is Invalid";
                ResponseModel.ResponseCode      = (int)PaymentEnum.Failed;
            }
            return(ResponseModel);
        }
 public override void SubmitComplete(UIButton button, ResponseModel response)
 {
     base.SubmitComplete(button, response);
 }
Beispiel #32
0
        /// <summary>
        /// Process Messages
        /// </summary>
        /// <returns></returns>
        public async Task <ResponseModel <List <MessageQueue> > > ProcessMessages(string inboundSemaphoreKey, ConnectionStrings connectionStrings)
        {
            ResponseModel <List <MessageQueue> > returnResponse = new ResponseModel <List <MessageQueue> >();

            returnResponse.Entity = new List <MessageQueue>();

            TransactionQueueSemaphore transactionQueueSemaphore = null;

            lock (_processingLock)
            {
                if (_processing == true)
                {
                    Console.WriteLine("Processing iteration aborted");
                    return(returnResponse);
                }

                _processing = true;
            }

            try
            {
                _inventoryManagementDataService.OpenConnection(connectionStrings.PrimaryDatabaseConnectionString);

                _inventoryManagementDataService.BeginTransaction((int)IsolationLevel.Serializable);

                Console.WriteLine("Get Lock at " + DateTime.Now.ToString());
                transactionQueueSemaphore = await _inventoryManagementDataService.GetTransactionQueueSemaphore(inboundSemaphoreKey);

                if (transactionQueueSemaphore == null)
                {
                    transactionQueueSemaphore = new TransactionQueueSemaphore();
                    transactionQueueSemaphore.SemaphoreKey = inboundSemaphoreKey;
                    await _inventoryManagementDataService.CreateTransactionQueueSemaphore(transactionQueueSemaphore);
                }
                else
                {
                    await _inventoryManagementDataService.UpdateTransactionQueueSemaphore(transactionQueueSemaphore);
                }

                List <TransactionQueueInbound> transactionQueue = await _inventoryManagementDataService.GetInboundTransactionQueue();

                foreach (TransactionQueueInbound transactionQueueItem in transactionQueue)
                {
                    int    senderId        = transactionQueueItem.SenderTransactionQueueId;
                    string exchangeName    = transactionQueueItem.ExchangeName;
                    string transactionCode = transactionQueueItem.TransactionCode;

                    TransactionQueueInboundHistory transactionHistory = await _inventoryManagementDataService.GetInboundTransactionQueueHistoryBySender(senderId, exchangeName);

                    if (transactionHistory != null)
                    {
                        await LogDuplicateMessage(transactionQueueItem);

                        await _inventoryManagementDataService.DeleteInboundTransactionQueueEntry(transactionQueueItem.TransactionQueueInboundId);
                    }
                    else if (transactionCode == TransactionQueueTypes.PurchaseOrderSubmitted)
                    {
                        await PurchaseOrderSubmitted(transactionQueueItem);

                        await _inventoryManagementDataService.DeleteInboundTransactionQueueEntry(transactionQueueItem.TransactionQueueInboundId);
                    }
                    else if (transactionCode == TransactionQueueTypes.SalesOrderSubmitted)
                    {
                        await SalesOrderSubmitted(transactionQueueItem);

                        await _inventoryManagementDataService.DeleteInboundTransactionQueueEntry(transactionQueueItem.TransactionQueueInboundId);
                    }
                    else if (transactionCode == TransactionQueueTypes.Acknowledgement)
                    {
                        await ProcessAcknowledgement(transactionQueueItem);

                        await _inventoryManagementDataService.DeleteInboundTransactionQueueEntry(transactionQueueItem.TransactionQueueInboundId);
                    }
                }

                await _inventoryManagementDataService.UpdateDatabase();

                _inventoryManagementDataService.CommitTransaction();

                _inventoryManagementDataService.CloseConnection();
            }
            catch (Exception ex)
            {
                _inventoryManagementDataService.RollbackTransaction();
                returnResponse.ReturnStatus = false;
                returnResponse.ReturnMessage.Add(ex.Message);
            }
            finally
            {
                _inventoryManagementDataService.CloseConnection();
                _processing = false;
            }

            return(returnResponse);
        }
Beispiel #33
0
        public ResponseModel Update([FromBody] UsersModel userDto)
        {
            // map dto to entity and set id
            //var user = _mapper.Map<TblUsers>(userDto);

            ResponseModel res = (new ResponseModel
            {
                Data = "",
                Status = "200",
                Message = ""
            });

            var password = userDto.Password;

            if (password != null && password != "")
            {
                byte[] passwordHa, passwordSa;
                using (var hmac = new System.Security.Cryptography.HMACSHA512())
                {
                    passwordSa = hmac.Key;

                    passwordHa = hmac.ComputeHash(System.Text.Encoding.UTF8.GetBytes(password));
                }
                var user = new UsersModel
                {
                    Id               = userDto.Id,
                    Cid              = userDto.Cid,
                    ContactByEmail   = userDto.ContactByEmail,
                    Email            = userDto.Email,
                    EncryptionActive = userDto.EncryptionActive,
                    FamilyName       = userDto.FamilyName,
                    GivenName        = userDto.GivenName,
                    TypeOfAccount    = userDto.TypeOfAccount,
                    UserName         = userDto.UserName,
                    PasswordHash     = passwordHa,
                    PasswordSalt     = passwordSa,
                    RoleID           = userDto.RoleID
                };
                //user.Id = id;

                try
                {
                    _userService.Update(user, userDto.Password);
                    res.Data = user;
                }
                catch (Exception ex)
                {
                    // return error message if there was an exception
                    //return BadRequest(new { message = ex.Message });
                    res.Message = "false";
                }
            }
            else
            {
                var user = new UsersModel
                {
                    Id               = userDto.Id,
                    Cid              = userDto.Cid,
                    ContactByEmail   = userDto.ContactByEmail,
                    Email            = userDto.Email,
                    EncryptionActive = userDto.EncryptionActive,
                    FamilyName       = userDto.FamilyName,
                    GivenName        = userDto.GivenName,
                    TypeOfAccount    = userDto.TypeOfAccount,
                    UserName         = userDto.UserName,
                    RoleID           = userDto.RoleID
                };

                //user.Id = id;

                try
                {
                    _userService.UpdateNoPass(user);
                    res.Data = user;
                }
                catch (Exception ex)
                {
                    // return error message if there was an exception
                    //return BadRequest(new { message = ex.Message });
                    res.Message = "false";
                }
            }
            return(res);
        }
Beispiel #34
0
 /// <summary>
 /// Checking if response is v2
 /// </summary>
 /// <param name="resp"></param>
 /// <returns></returns>
 private bool ISv2Resp(ResponseModel resp)
 {
     return(!string.IsNullOrEmpty(resp.data) && resp.version == "2.0");
 }
Beispiel #35
0
 public OutletManager()
 {
     _aRepository = new GenericRepositoryInv <InvOutlet>();
     _aModel      = new ResponseModel();
 }
Beispiel #36
0
        public async Task <ActionResult> LoadProducts(int page = 1, int count = 5, int pid = 0, string title = null, string code = null)
        {
            try
            {
                List <ProductModel>             data        = (List <ProductModel>)(await this._repository.GetAll()).Data;
                List <ProductCombineModel>      AllCombines = ((List <ProductCombineModel>)(await this._combinerepository.GetAll()).Data).Where(x => !x.X_IsDeleted).ToList();
                List <OutModels.Models.Product> result      = new List <OutModels.Models.Product>();
                if (pid != 0)
                {
                    result = _mapper.Map <List <ProductModel>, List <OutModels.Models.Product> >(data.Where(x => x.P_Id != pid).ToList());
                }
                else
                {
                    result = _mapper.Map <List <ProductModel>, List <OutModels.Models.Product> >(data.ToList());
                }

                if (title != null)
                {
                    result = result.Where(x => x.P_Title.Contains(title, StringComparison.InvariantCultureIgnoreCase)).ToList();
                }
                if (code != null)
                {
                    result = result.Where(x => x.P_Code.Contains(code, StringComparison.InvariantCultureIgnoreCase)).ToList();
                }

                List <object> Prods = new List <object>();
                foreach (var item in result)
                {
                    var ProdCombines = AllCombines.Where(x => x.X_ProductId == item.P_Id && x.X_Status && !x.X_IsDeleted).ToList();
                    if (ProdCombines.Count > 0)
                    {
                        int i = 1;
                        foreach (var combine in ProdCombines)
                        {
                            var w = await _warrantyrepo.GetById(combine.X_WarrantyId);

                            var c = await _colorrepo.GetById(combine.X_ColorId);

                            if (w != null && c != null)
                            {
                                Prods.Add(new
                                {
                                    counter  = i,
                                    id       = item.P_Id,
                                    code     = item.P_Code,
                                    title    = item.P_Title,
                                    warranty = w.W_Title,
                                    wid      = w.W_Id,
                                    cid      = c.C_Id,
                                    color    = c.C_Title,
                                    price    = combine.X_Price.ToString("#,#"),
                                    discount = combine.X_Discount.ToString("#,#") + (combine.X_DiscountType == 1 ? " %" : "")
                                });
                                i++;
                            }
                        }
                    }
                }
                int totalPages = (int)Math.Ceiling((double)Prods.Count() / count);
                Prods = Prods.Skip(count * (page - 1)).Take(count).ToList();
                return(new JsonResult(ResponseModel.Success("PRODUCTS_LIST_RETURNED", new { Products = Prods, TotalPages = totalPages, CurrentPage = page })));
            }
            catch (Exception ex)
            {
                return(new JsonResult(ResponseModel.ServerInternalError(data: ex)));
            }
        }
Beispiel #37
0
 public string GetLocation(ResponseModel <ArchiveSerialNumber> model)
 {
     throw new System.NotImplementedException();
 }
 public IHttpActionResult SameAction(ResponseModel model)
 {
     return(this.Ok());
 }
 public IActionResult Add()
 {
     ViewData["ApplicationIdNameDic"] = _tenantApplicationLicenseService.GetApplicationIdNameDic();
     return(View(ResponseModel.Success(new TenantApplicationLicense())));
 }
Beispiel #40
0
        private IResponseBuilder InitResponseBuilder(ResponseModel responseModel)
        {
            IResponseBuilder responseBuilder = Response.Create();

            if (responseModel.Delay > 0)
            {
                responseBuilder = responseBuilder.WithDelay(responseModel.Delay.Value);
            }

            if (responseModel.UseTransformer == true)
            {
                responseBuilder = responseBuilder.WithTransformer(responseModel.UseTransformerForBodyAsFile == true);
            }

            if (!string.IsNullOrEmpty(responseModel.ProxyUrl))
            {
                var proxyAndRecordSettings = new ProxyAndRecordSettings
                {
                    Url = responseModel.ProxyUrl,
                    ClientX509Certificate2ThumbprintOrSubjectName = responseModel.X509Certificate2ThumbprintOrSubjectName,
                    WebProxySettings = responseModel.WebProxy != null ? new WebProxySettings
                    {
                        Address  = responseModel.WebProxy.Address,
                        UserName = responseModel.WebProxy.UserName,
                        Password = responseModel.WebProxy.Password
                    } : null
                };

                return(responseBuilder.WithProxy(proxyAndRecordSettings));
            }

            switch (responseModel.StatusCode)
            {
            case int statusCodeAsInteger:
                responseBuilder = responseBuilder.WithStatusCode(statusCodeAsInteger);
                break;

            case string statusCodeAsString:
                responseBuilder = responseBuilder.WithStatusCode(statusCodeAsString);
                break;
            }

            if (responseModel.Headers != null)
            {
                foreach (var entry in responseModel.Headers)
                {
                    responseBuilder = entry.Value is string value?
                                      responseBuilder.WithHeader(entry.Key, value) :
                                          responseBuilder.WithHeader(entry.Key, JsonUtils.ParseJTokenToObject <string[]>(entry.Value));
                }
            }
            else if (responseModel.HeadersRaw != null)
            {
                foreach (string headerLine in responseModel.HeadersRaw.Split(new[] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries))
                {
                    int    indexColon = headerLine.IndexOf(":", StringComparison.Ordinal);
                    string key        = headerLine.Substring(0, indexColon).TrimStart(' ', '\t');
                    string value      = headerLine.Substring(indexColon + 1).TrimStart(' ', '\t');
                    responseBuilder = responseBuilder.WithHeader(key, value);
                }
            }

            if (responseModel.BodyAsBytes != null)
            {
                responseBuilder = responseBuilder.WithBody(responseModel.BodyAsBytes, responseModel.BodyDestination, ToEncoding(responseModel.BodyEncoding));
            }
            else if (responseModel.Body != null)
            {
                responseBuilder = responseBuilder.WithBody(responseModel.Body, responseModel.BodyDestination, ToEncoding(responseModel.BodyEncoding));
            }
            else if (responseModel.BodyAsJson != null)
            {
                responseBuilder = responseBuilder.WithBodyAsJson(responseModel.BodyAsJson, ToEncoding(responseModel.BodyEncoding), responseModel.BodyAsJsonIndented == true);
            }
            else if (responseModel.BodyAsFile != null)
            {
                responseBuilder = responseBuilder.WithBodyFromFile(responseModel.BodyAsFile);
            }

            if (responseModel.Fault != null && Enum.TryParse(responseModel.Fault.Type, out FaultType faultType))
            {
                responseBuilder.WithFault(faultType, responseModel.Fault.Percentage);
            }

            return(responseBuilder);
        }
 public static List <T> GetResultAsList <T>(ResponseModel responseModel)
 {
     return(((JArray)responseModel.Value).ToObject <List <T> >());
 }
Beispiel #42
0
        public ResponseModel postUpdateCandidateProfile(CandidateRegMdl model)
        {
            ResponseModel response_model = null;
            StringContent content;

            try
            {
                var RestURL = BaseURL + "candidate_register";

                HttpClient client = new HttpClient();
                client.BaseAddress = new Uri(RestURL);

                JObject j = new JObject();
                j.Add("name", model.NAME);
                j.Add("phone", model.PHONE);
                j.Add("gender", model.GENDER);
                j.Add("location", model.LOCATION);
                j.Add("experience", model.EXPERIENCE);
                j.Add("skill", model.SKILL);
                j.Add("email", model.EMAIL);
                j.Add("strength", model.STRENGTH);
                j.Add("expected_salary", model.EXPECTED_SALARY);
                j.Add("address", model.ADDRESS);
                j.Add("prefered_location", model.PREFERED_LOCATION);
                j.Add("objective", model.OBJECTIVE);
                j.Add("brief_description", model.BRIEF_DESCRIPTION);

                var json = JsonConvert.SerializeObject(j);
                content = new StringContent(json, Encoding.UTF8, "application/json");

                HttpResponseMessage response = client.PostAsync(RestURL, content).Result; // Blocking call!
                if (response.IsSuccessStatusCode)
                {
                    response_model = new ResponseModel();
                    // Parse the response body. Blocking!
                    var     dataObjects = response.Content.ReadAsStringAsync().Result;
                    JObject jObj        = JObject.Parse(dataObjects);
                    response_model.NAME              = jObj["data"]["name"].ToString();
                    response_model.GENDER            = jObj["data"]["gender"].ToString();
                    response_model.LOCATION          = jObj["data"]["location"].ToString();
                    response_model.EMAIL             = jObj["data"]["email"].ToString();
                    response_model.PHONE             = jObj["data"]["phone"].ToString();
                    response_model.EXPECTED_SALARY   = jObj["data"]["expected_salary"].ToString();
                    response_model.EXPERIENCE        = jObj["data"]["experience"].ToString();
                    response_model.SKILL             = jObj["data"]["skill"].ToString();
                    response_model.STRENGTH          = jObj["data"]["strength"].ToString();
                    response_model.ADDRESS           = jObj["data"]["address"].ToString();
                    response_model.PREFERED_LOCATION = jObj["data"]["prefered_location"].ToString();
                    response_model.OBJECTIVE         = jObj["data"]["objective"].ToString();
                    response_model.BRIEF_DESCRIPTION = jObj["data"]["brief_description"].ToString();
                    response_model.USER_TYPE         = jObj["data"]["user_type"].ToString();
                    response_model.ERROR             = jObj["error"].ToString();
                    response_model.MESSAGE           = jObj["message"].ToString();
                    response_model.RCCODE            = jObj["rccode"].ToString();
                    response_model.SUCCESS           = jObj["success"].ToString();
                }
            }
            catch (Exception e)
            {
                StaticMethods.AndroidSnackBar(e.Message);
            }
            finally
            {
                content = null;
            }
            return(response_model);
        }
Beispiel #43
0
        public async Task <ResponseModel> UpdateAmount(ClaimsIdentity identity, BalanceUpdateVerb verb, decimal amount = default(decimal))
        {
            HttpResponseMessage response = null;
            ResponseModel       result   = null;
            User user = null;

            try
            {
                switch (verb)
                {
                case BalanceUpdateVerb.Replenishment:
                    result = await GetUser(identity);

                    if (result.IsSuccess)
                    {
                        user         = result.Object as User;
                        user.Amount += amount;
                        var model   = new { user.Amount };
                        var content = new StringContent(JsonConvert.SerializeObject(model), Encoding.UTF8, "application/json");
                        response = await _requestHelper.SendRequest("api/user/" + identity.GetUserId <int>() + "/balance",
                                                                    RequestVerbs.PUT,
                                                                    content,
                                                                    identity.GetClaimValue(BearerTokenClaimKey));

                        result = await _requestHelper.GetResultFromResponse <string>(response, "message");

                        if (result.IsSuccess)
                        {
                            identity.AddUpdateClaim(AuthManager.AccountBalanceClaimKey, user.Amount.ToString(CultureInfo.InvariantCulture));
                        }
                    }
                    break;

                case BalanceUpdateVerb.UpdateFromServer:
                    result = await GetUser(identity);

                    if (result.IsSuccess)
                    {
                        user = result.Object as User;
                        identity.AddUpdateClaim(AuthManager.AccountBalanceClaimKey, user.Amount.ToString(CultureInfo.InvariantCulture));
                    }
                    break;
                }
            }
            catch (JsonSerializationException exception)
            {
                return(new ResponseModel
                {
                    Message = exception.Message,
                    IsSuccess = false
                });
            }
            catch (SecurityTokenException exception)
            {
                return(new ResponseModel
                {
                    Message = exception.Message,
                    IsSuccess = false
                });
            }

            return(result);
        }
Beispiel #44
0
        internal async Task <ResponseModel> GetUserReport(UserReportParam parameters, int loginId)
        {
            ResponseModel     response = new ResponseModel();
            List <UserReport> result   = new List <UserReport>();

            using (IDbConnection conn = _dbConnection.Connection)
            {
                DynamicParameters param = new DynamicParameters();

                /*
                 *  var valueIds = new DataTable();
                 *
                 *  if (parameters.userids == null)
                 *      parameters.userids = new List<int>() { 0 };
                 *
                 *  valueIds.Columns.Add("ID", typeof(string));
                 *  parameters.userids.ForEach(x =>
                 *  {
                 *      var dr = valueIds.NewRow();
                 *      dr[0] = x;
                 *      valueIds.Rows.Add(dr);
                 *  });
                 *
                 *  valueIds.AcceptChanges();
                 *
                 *  param.Add("@UserIds", valueIds.AsTableValuedParameter("TABLE_ID_INT"));
                 */

                string userIds = string.Empty;
                if (parameters.userids != null && parameters.userids.Count > 0)
                {
                    userIds = string.Join(",", parameters.userids);
                }

                if (!string.IsNullOrWhiteSpace(userIds))
                {
                    param.Add("@UserIds", userIds, DbType.String);
                }
                if (!string.IsNullOrWhiteSpace(parameters.jobcode))
                {
                    param.Add("@JobCode", parameters.jobcode, DbType.String);
                }
                if (!string.IsNullOrWhiteSpace(parameters.title))
                {
                    param.Add("@Title", parameters.title, DbType.String);
                }
                if (!string.IsNullOrWhiteSpace(parameters.location))
                {
                    param.Add("@Location", parameters.location, DbType.String);
                }
                if (!string.IsNullOrWhiteSpace(parameters.publisheddate))
                {
                    param.Add("@PublishedDate", parameters.publisheddate, DbType.String);
                }
                if (!string.IsNullOrWhiteSpace(parameters.assingeddate))
                {
                    param.Add("@AssignedDate", parameters.assingeddate, DbType.String);
                }
                if (!string.IsNullOrWhiteSpace(parameters.fromdate))
                {
                    param.Add("@FromDate", parameters.fromdate, DbType.String);
                }
                if (!string.IsNullOrWhiteSpace(parameters.todate))
                {
                    param.Add("@ToDate", parameters.todate, DbType.String);
                }
                if (parameters.lastdays != -1)
                {
                    param.Add("@LastDays", parameters.lastdays, DbType.Int32);
                }

                dynamic data = await conn.QueryAsync <UserReport>(Constants.StoredProcedure.GETUSERREPORT, param, null, null, CommandType.StoredProcedure);

                result = (List <UserReport>)data;

                response.ResultStatus = result.Count > 0 ? Constants.ResponseResult.SUCCESS : Constants.ResponseResult.NODATA;
                response.Output       = result;
                response.OutputCount  = result.Count;
            }

            return(response);
        }
Beispiel #45
0
 public IActionResult Add()
 {
     SetDataSource();
     return(View(ResponseModel.Success(new InterfaceAggregation {
     })));
 }
Beispiel #46
0
 public PaymentController()
 {
     response = new ResponseModel();
 }
Beispiel #47
0
 object IResourceBuilder <ResponseModel <ArchiveSerialNumber> > .Build(
     ResponseModel <ArchiveSerialNumber> archiveSerialNumberModel) =>
 this.Build(archiveSerialNumberModel);
Beispiel #48
0
        /// <summary>
        /// Get Messages To Send
        /// </summary>
        /// <param name="messageQueueConfigurations"></param>
        /// <param name="outboundSemaphoreKey"></param>
        /// <param name="connectionStrings"></param>
        /// <returns></returns>
        private async Task <ResponseModel <List <MessageQueue> > > GetMessagesToSend(List <IMessageQueueConfiguration> messageQueueConfigurations, string outboundSemaphoreKey, ConnectionStrings connectionStrings)
        {
            TransactionQueueSemaphore transactionQueueSemaphore = null;

            ResponseModel <List <MessageQueue> > returnResponse = new ResponseModel <List <MessageQueue> >();

            returnResponse.Entity = new List <MessageQueue>();

            try
            {
                _inventoryManagementDataService.OpenConnection(connectionStrings.PrimaryDatabaseConnectionString);
                _inventoryManagementDataService.BeginTransaction((int)IsolationLevel.Serializable);

                transactionQueueSemaphore = await _inventoryManagementDataService.GetTransactionQueueSemaphore(outboundSemaphoreKey);

                if (transactionQueueSemaphore == null)
                {
                    transactionQueueSemaphore = new TransactionQueueSemaphore();
                    transactionQueueSemaphore.SemaphoreKey = outboundSemaphoreKey;
                    await _inventoryManagementDataService.CreateTransactionQueueSemaphore(transactionQueueSemaphore);
                }
                else
                {
                    await _inventoryManagementDataService.UpdateTransactionQueueSemaphore(transactionQueueSemaphore);
                }

                List <TransactionQueueOutbound> transactionQueue = await _inventoryManagementDataService.GetOutboundTransactionQueue();

                foreach (TransactionQueueOutbound transactionQueueItem in transactionQueue)
                {
                    MessageQueue message = new MessageQueue();
                    message.ExchangeName       = transactionQueueItem.ExchangeName;
                    message.TransactionQueueId = transactionQueueItem.TransactionQueueOutboundId;
                    message.TransactionCode    = transactionQueueItem.TransactionCode;
                    message.Payload            = transactionQueueItem.Payload;

                    IMessageQueueConfiguration messageQueueConfiguration = messageQueueConfigurations.Where(x => x.TransactionCode == message.TransactionCode).FirstOrDefault();
                    if (messageQueueConfiguration == null)
                    {
                        break;
                    }

                    ResponseModel <MessageQueue> messageQueueResponse = messageQueueConfiguration.SendMessage(message);
                    if (messageQueueResponse.ReturnStatus == true)
                    {
                        transactionQueueItem.SentToExchange     = true;
                        transactionQueueItem.DateSentToExchange = DateTime.UtcNow;
                        await _inventoryManagementDataService.UpdateOutboundTransactionQueue(transactionQueueItem);

                        returnResponse.Entity.Add(message);
                    }
                    else
                    {
                        break;
                    }
                }

                await _inventoryManagementDataService.UpdateDatabase();

                _inventoryManagementDataService.CommitTransaction();
                _inventoryManagementDataService.CloseConnection();
            }
            catch (Exception ex)
            {
                _inventoryManagementDataService.RollbackTransaction();
                returnResponse.ReturnStatus = false;
                returnResponse.ReturnMessage.Add(ex.Message);
            }
            finally
            {
                _inventoryManagementDataService.CloseConnection();
            }

            return(returnResponse);
        }
Beispiel #49
0
 public static IHttpActionResult GetResult(ResponseModel result, HttpRequestMessage request, object data = null)
 {
     return(ModelResult.GetResult(result.Messagge, result.ResponseCode, request, result));
 }
        /// <summary>
        /// The actual Work to be done.
        /// </summary>
        protected override void Execute()
        {
            List <TranscriptionModel> newlist = new List <TranscriptionModel>();

            List <transcription> allTranscriptions = TranscriptionRepository.GetAll().ToList();

            var predicate = PredicateBuilder.True <transcription>();

            //predicate = predicate.And(p => p.IsConvertToDigital == Request.ReportModel.IsDigitallyMigrated);
            ////predicate = predicate.And(p => p.IsBornDigital == Request.ReportModel.IsDigitallyMigrated);

            //predicate = predicate.And(p => p.IsAudioFormat == Request.ReportModel.IsAudioFormat);
            //predicate = predicate.And(p => p.IsVideoFormat == Request.ReportModel.IsVideoFormat);

            // Online and offline comparision
            if (Request.ReportModel.IsOnline && Request.ReportModel.IsOffline)
            {
                predicate = predicate;
            }
            else if (Request.ReportModel.IsOnline)
            {
                predicate = predicate.And(p => p.IsOnline);
            }
            else if (Request.ReportModel.IsOffline)
            {
                predicate = predicate.And(p => !p.IsOnline);
            }

            // Born digital or converted to digital
            if (Request.ReportModel.IsConvertedDigital && Request.ReportModel.IsBornDigitally)
            {
                predicate = predicate.And(p => p.IsBornDigital && p.IsConvertToDigital);
            }
            else if (Request.ReportModel.IsConvertedDigital)
            {
                predicate = predicate.And(p => p.IsConvertToDigital);
            }
            else if (Request.ReportModel.IsBornDigitally)
            {
                predicate = predicate.And(p => p.IsBornDigital);
            }

            // Begin and end date
            if (Request.ReportModel.BeginDate != null && Request.ReportModel.EndDate == null)
            {
                predicate = predicate.And(p => Convert.ToDateTime(p.InterviewDate) >= Request.ReportModel.BeginDate ||
                                          (!string.IsNullOrEmpty(p.InterviewDate1) && Convert.ToDateTime(p.InterviewDate1) >= Request.ReportModel.BeginDate) ||
                                          (!string.IsNullOrEmpty(p.InterviewDate2) && Convert.ToDateTime(p.InterviewDate2) >= Request.ReportModel.BeginDate));
            }
            else if (Request.ReportModel.BeginDate == null && Request.ReportModel.EndDate != null)
            {
                predicate = predicate.And(p => Convert.ToDateTime(p.InterviewDate) < Request.ReportModel.EndDate ||
                                          (!string.IsNullOrEmpty(p.InterviewDate1) && Convert.ToDateTime(p.InterviewDate1) < Request.ReportModel.EndDate) ||
                                          (!string.IsNullOrEmpty(p.InterviewDate2) && Convert.ToDateTime(p.InterviewDate2) < Request.ReportModel.EndDate));
            }
            else if (Request.ReportModel.BeginDate != null && Request.ReportModel.EndDate != null)
            {
                predicate = predicate.And(p => (Convert.ToDateTime(p.InterviewDate) >= Request.ReportModel.BeginDate ||
                                                (!string.IsNullOrEmpty(p.InterviewDate1) && Convert.ToDateTime(p.InterviewDate1) >= Request.ReportModel.BeginDate) ||
                                                (!string.IsNullOrEmpty(p.InterviewDate2) && Convert.ToDateTime(p.InterviewDate2) >= Request.ReportModel.BeginDate)) &&
                                          (Convert.ToDateTime(p.InterviewDate) < Request.ReportModel.EndDate ||
                                           (!string.IsNullOrEmpty(p.InterviewDate1) && Convert.ToDateTime(p.InterviewDate1) < Request.ReportModel.EndDate) ||
                                           (!string.IsNullOrEmpty(p.InterviewDate2) && Convert.ToDateTime(p.InterviewDate2) < Request.ReportModel.EndDate)));
            }

            // Interviewer
            if (!string.IsNullOrEmpty(Request.ReportModel.Interviewer))
            {
                predicate = predicate.And(p => p.Interviewer.ToLower().Contains(Request.ReportModel.Interviewer.ToLower()));
            }

            // location
            if (!string.IsNullOrEmpty(Request.ReportModel.Location))
            {
                predicate = predicate.And(p => p.Place.ToLower().Contains(Request.ReportModel.Location.ToLower()));
            }

            IEnumerable <transcription> dataset3 = allTranscriptions.Where <transcription>(predicate.Compile());

            foreach (transcription item in dataset3.ToList())
            {
                newlist.Add(Util.ConvertToTranscriptionModel(item));
            }

            Response = new ResponseModel()
            {
                Transcriptions     = newlist,
                IsOperationSuccess = true
            };
        }
Beispiel #51
0
        private async Task <PlayerSpawnPointInstanceModel> RefreshInstanceData([NotNull] IPlayerSpawnPointDataServiceClient client)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            ResponseModel <PlayerSpawnPointInstanceModel, SceneContentQueryResponseCode> queryResponseModel = await client.GetSpawnPointInstance(GetTarget().PlayerSpawnPointId);

            //TODO: No idea what should be done here.
            if (!queryResponseModel.isSuccessful)
            {
                return(null);
            }

            return(queryResponseModel.Result);
        }
Beispiel #52
0
        public IActionResult Update(Guid id)
        {
            var metaObject = _metaFieldService.GetById(id);

            return(View(ResponseModel.Success(data: metaObject)));
        }
Beispiel #53
0
        public ResponseModel postEmployerUpdateProfile(ResponseModel model)
        {
            ResponseModel response_model = null;
            StringContent content;

            try
            {
                var RestURL = BaseURL + "employer_update";

                HttpClient client = new HttpClient();
                client.BaseAddress = new Uri(RestURL);

                JObject j = new JObject();
                j.Add("company_name", model.COMPANY_NAME);
                j.Add("phone", model.PHONE);
                j.Add("contact_person", model.CONTACT_PERSON);
                j.Add("current_requirment", model.CURRENT_REQUIRMENT);
                j.Add("experience", model.EXPERIENCE);
                j.Add("skill", model.SKILL);
                j.Add("email", model.EMAIL);
                j.Add("job_role", model.JOB_ROLE);
                j.Add("location", model.LOCATION);
                j.Add("address", model.ADDRESS);

                var json = JsonConvert.SerializeObject(j);
                content = new StringContent(json, Encoding.UTF8, "application/json");

                HttpResponseMessage response = client.PostAsync(RestURL, content).Result; // Blocking call!
                if (response.IsSuccessStatusCode)
                {
                    response_model = new ResponseModel();
                    // Parse the response body. Blocking!
                    var     dataObjects = response.Content.ReadAsStringAsync().Result;
                    JObject jObj        = JObject.Parse(dataObjects);
                    response_model.COMPANY_NAME       = jObj["data"]["company_name"].ToString();
                    response_model.CONTACT_PERSON     = jObj["data"]["contact_person"].ToString();
                    response_model.PHONE              = jObj["data"]["phone"].ToString();
                    response_model.CURRENT_REQUIRMENT = jObj["data"]["current_requirment"].ToString();
                    response_model.EXPERIENCE         = jObj["data"]["experience"].ToString();
                    response_model.SKILL              = jObj["data"]["skill"].ToString();
                    response_model.JOB_ROLE           = jObj["data"]["job_role"].ToString();
                    response_model.LOCATION           = jObj["data"]["location"].ToString();
                    response_model.ADDRESS            = jObj["data"]["address"].ToString();
                    response_model.EMAIL              = jObj["data"]["email"].ToString();
                    response_model.USER_TYPE          = jObj["data"]["user_type"].ToString();
                    response_model.ERROR              = jObj["error"].ToString();
                    response_model.MESSAGE            = jObj["message"].ToString();
                    response_model.RCCODE             = jObj["rccode"].ToString();
                    response_model.SUCCESS            = jObj["success"].ToString();
                }
            }
            catch (Exception e)
            {
                StaticMethods.AndroidSnackBar(e.Message);
            }
            finally
            {
                content = null;
            }
            return(response_model);
        }
        public async Task <ResponseModel <List <UserServicesItem> > > GetAsync(SearchParam fipso, SecurityModel securityModel)
        {
            ResponseModel <List <UserServicesItem> > response = new ResponseModel <List <UserServicesItem> >();

            try
            {
                PagingInfo paging = new PagingInfo();
                paging.CurrentPage    = fipso.CurrentPage;
                paging.PageSize       = fipso.PageSize;
                paging.SortDirection  = fipso.SortDirection;
                paging.SortExpression = fipso.SortExpression;

                ScanFilter filter = new ScanFilter();
                switch (fipso.Status)
                {
                case "Rejected":
                    filter.AddCondition("RequestStatus", ScanOperator.Equal, "Rejected");
                    break;

                case "Approved":
                    filter.AddCondition("RequestStatus", ScanOperator.Equal, "Approved");
                    break;

                default:
                    filter.AddCondition("RequestStatus", ScanOperator.Equal, "Requested");
                    break;
                }

                if (string.IsNullOrEmpty(fipso.SortExpression))
                {
                    fipso.SortExpression = "SubmittedOn";
                }
                if (paging.SortDirection != string.Empty)
                {
                    fipso.SortExpression = fipso.SortExpression + " " + paging.SortDirection;
                }
                int rows = 0;
                IEnumerable <UserServicesItem> requestedItem = await _dynamodbContext.GetAsync(filter);

                var filterData = new List <UserServicesItem>();
                if (!string.IsNullOrEmpty(fipso.SearchText))
                {
                    filterData = requestedItem.Where(x => x.BookName.ToLower().Contains(fipso.SearchText.ToLower()) ||
                                                     x.BookAuthor.ToLower().Contains(fipso.SearchText) ||
                                                     x.UserName.ToLower().Contains(fipso.SearchText)
                                                     ).ToList();
                }
                else
                {
                    filterData = requestedItem.ToList();
                }
                var resultList = from p in filterData.AsQueryable() select p;
                rows = resultList.Count();

                var requestedBookList = resultList.OrderBy(fipso.SortExpression).Skip((paging.CurrentPage - 1) * paging.PageSize).Take(paging.PageSize).ToList();
                paging.TotalRows  = rows;
                paging.TotalPages = Functions.CalculateTotalPages(rows, paging.PageSize);

                response.Entity     = requestedBookList;
                response.TotalRows  = paging.TotalRows;
                response.TotalPages = paging.TotalPages;
                response.Status     = true;
            }
            catch (AmazonServiceException amazonEx)
            {
                response.Status = false;
                response.ReturnMessage.Add($"Amazon error in table operation! Error: {amazonEx.Message}");
            }
            catch (System.Exception ex)
            {
                response.Status = false;
                response.ReturnMessage.Add(ex.Message);
            }
            return(response);
        }
        public ActionResult <ResponseModel <List <CityModel> > > GetAll()
        {
            var cityList = _cityService.GetAll();

            return(ResponseModel <List <CityModel> > .FormResponse("cities", cityList, "Unable to get cities"));
        }
        public async Task <ResponseModel <string> > ApproveUserRequest(RequestApproveModel entity, SecurityModel securityModel)
        {
            ResponseModel <string> response = new ResponseModel <string>();

            try
            {
                var bookRequestbyUser = await _dynamodbContext.GetByIdAsync(entity.Id);

                var user = await _dynamoDbUserContex.GetByIdAsync(entity.UserId);

                var book = await _dynamoDBBookContext.GetByIdAsync(entity.BookId);

                bookRequestbyUser.RequestStatus = entity.Status; //Approved, Rejected
                await _dynamodbContext.SaveAsync(bookRequestbyUser);

                if (entity.Status == "Approved")
                {
                    book.RemaningStock = (book.Stock - 1);
                    book.UserDetails.Add(_mapper.Map <UserViewModel>(user));
                    book.librarian.IssieOn = DateTime.UtcNow;
                    book.librarian.RenewOn = DateTime.UtcNow.AddDays(7);
                    await _dynamoDBBookContext.SaveAsync(book);

                    InventoryHistory invHistory = new InventoryHistory
                    {
                        Id              = Guid.NewGuid().ToString(),
                        BookId          = entity.BookId,
                        BookAuthor      = book.BookAuthor,
                        BookDescription = book.BookDescription,
                        BookName        = book.BookName,
                        BookPrice       = book.BookPrice,
                        BookPublication = book.BookPublication,
                        BookType        = book.BookType,
                        City            = user.City,
                        Email           = user.Email,
                        FirstName       = user.FirstName,
                        LastName        = user.LastName,
                        MobileNumber    = user.MobileNumber,
                        PostCode        = user.PostCode,
                        State           = user.State,
                        Suburb          = user.Suburb,
                        UserId          = entity.UserId,
                        UserName        = user.Email,
                        librarian       = new librarian
                        {
                            BookId           = entity.BookId,
                            IssieOn          = book.librarian.IssieOn,
                            IssueDescription = book.librarian.IssueDescription,
                            RenewOn          = book.librarian.RenewOn
                        },
                        RenewOn      = book.librarian.RenewOn,
                        ReturnStatus = BookReturnStatus.Borrow
                    };
                    await _dynamoDbHistoryContex.SaveAsync(invHistory);
                }
                else
                {
                    bookRequestbyUser.IsReserved = false;
                }
                await _mailService.SendMail("", user.Email, "Request '" + entity.Status + "'", "Hi '" + user.FirstName + "' you request has been '" + entity.Status + "'");

                response.Entity = "success";
                response.Status = true;
                response.ReturnMessage.Add("Request has been " + entity.Status + " sucessfully.");
            }
            catch (AmazonServiceException amazon)
            {
                response.Status = false;
                response.ReturnMessage.Add($"Amazon error in table operation! Error: {amazon.Message}");
            }
            catch (Exception ex)
            {
                response.Status = false;
                response.ReturnMessage.Add(ex.Message);
            }
            return(response);
        }
Beispiel #57
0
        public JsonResult CreateDetail(List <ConfigurationDetail> detail)
        {
            var resultCreate = new ResponseModel();
            var resultUpdate = new ResponseModel();
            var resultDelete = new ResponseModel();

            //แยก create, update, delete
            var creates = detail.Where(r => r.ID == Guid.Empty).ToList();
            var updates = detail.Where(r => r.ID != Guid.Empty).ToList();
            var deletes = updates.Select(r => r.ID).ToList();

            var dateNow = DateTime.Now;
            var userBy  = _userProfile.UserID;

            #region Delete
            if (deletes.Any())
            {
                var masterID = detail.FirstOrDefault(r => r.ConfigurationID != Guid.Empty).ConfigurationID;
                if (masterID != null)
                {
                    resultDelete = _configurationDataService.DeleteDetail(masterID, deletes);
                }

                if (!resultDelete.Success || masterID == null)
                {
                    resultUpdate.Message = "Delete ConfigulationDetail Fail.";
                    return(Json(resultDelete));
                }
            }
            else
            {
                resultDelete.Success = true;
            }
            #endregion

            #region Update
            if (updates.Any())
            {
                updates.ForEach(r => { r.UpdateDate = dateNow; r.UpdateBy = userBy; });
                resultUpdate = _configurationDataService.UpdateDetail(updates);

                if (!resultUpdate.Success)
                {
                    resultUpdate.Message = "Update ConfigulationDetail Fail.";
                    return(Json(resultUpdate));
                }
            }
            else
            {
                resultUpdate.Success = true;
            }
            #endregion

            #region Create
            if (creates.Any())
            {
                creates.ForEach(r => { r.CreateDate = dateNow; r.CreateBy = userBy; });
                resultCreate = _configurationDataService.CreateDetail(creates);

                if (!resultCreate.Success)
                {
                    resultCreate.Message = "Create ConfigulationDetail Fail.";
                    return(Json(resultCreate));
                }
            }
            else
            {
                resultCreate.Success = true;
            }
            #endregion

            var IsSuccess = resultCreate.Success && resultUpdate.Success && resultDelete.Success;
            var result    = new ResponseModel
            {
                Success = IsSuccess,
                Message = IsSuccess
                ? EnumHttpStatus.SUCCESS.AsDescription()
                : EnumHttpStatus.INTERNAL_SERVER_ERROR.AsDescription()
            };

            return(Json(result));
        }
        public ActionResult <ResponseModel <CityModel> > Get(string id)
        {
            var city = _cityService.Get(id);

            return(ResponseModel <CityModel> .FormResponse("city", city, "City not found"));
        }
Beispiel #59
0
        public ResponseModel<String> WebRegisterService(RegisterationRequest req, HttpRequestBase request)
        {            
            var response = new ResponseModel<String>();
            if (_db.Users.Any(x => x.Username == req.Username))
            {
                response.Status = 409;
                response.Message = "conflict";
                return response;
            }

            var guid = Guid.NewGuid().ToString();
            var user = new User
            {
                Username = req.Username,
                Password = EncryptionClass.Md5Hash(req.Password),
                Source = req.Source,
                isActive = "false",
                Type = req.Type,
                guid = Guid.NewGuid().ToString(),
                fixedGuid= Guid.NewGuid().ToString(),
                FirstName = req.FirstName,
                LastName = req.LastName,
                gender = "NA",
                ImageUrl = "NA"
            };
            _db.Users.Add(user);
            
            if (!Constants.NA.Equals(req.Referral))
            {
                new ReferralService().payReferralBonusAsync(req.Referral, req.Username,Constants.status_false);
            }
            if (req.Type == "client")
            {
                var dbClientDetails = new ClientDetail
                {
                    Username = req.Username,
                    CompanyName =  string.IsNullOrEmpty(req.CompanyName)?"NA":req.CompanyName
                };
                _db.ClientDetails.Add(dbClientDetails);
            }
            var dbValidateUserKey = new ValidateUserKey
            {
                Username = req.Username,
                guid = guid
            };

            _db.ValidateUserKeys.Add(dbValidateUserKey);

            try
            {
                _db.SaveChanges();
                var signalRHub = new SignalRHub();
                string totalProjects = "";
                string successRate = "";
                string totalUsers = _db.Users.Count().ToString(CultureInfo.InvariantCulture);
                string projectCategories = "";
                var hubContext = GlobalHost.ConnectionManager.GetHubContext<SignalRHub>();
                hubContext.Clients.All.updateBeforeLoginUserProjectDetails(totalProjects, successRate, totalUsers, projectCategories);
                SendAccountCreationValidationEmail.SendAccountCreationValidationEmailMessage(req.Username, guid, request);
            }
            catch (DbEntityValidationException e)
            {
                DbContextException.LogDbContextException(e);
                response.Status = 500;
                response.Message = "Internal Server Error !!!";
                return response;
            }

            response.Status = 200;
            response.Message = "success";
            response.Payload = "Account Created";

            return response;
        }
        public ActionResult <ResponseModel <CityModel> > Create(CityModel cityModel)
        {
            var city = _cityService.Create(cityModel);

            return(ResponseModel <CityModel> .FormResponse("city", city, "Unable to create city"));
        }