Ejemplo n.º 1
0
        public async Task <LoginResult> Login(LoginModel loginModel)
        {
            var loginAsJson = JsonSerializer.Serialize(loginModel);
            var response    = await _httpClient.PostAsync("Login", new StringContent(loginAsJson, Encoding.UTF8, "application/json"));

            var loginResult = JsonSerializer.Deserialize <LoginResult>(await response.Content.ReadAsStringAsync(), new JsonSerializerOptions {
                PropertyNameCaseInsensitive = true
            });

            if (!response.IsSuccessStatusCode)
            {
                return(loginResult);
            }

            await _localStorage.SetItemAsync("authToken", loginResult.Token);

            ((ApiAuthenticationStateProvider)_authenticationStateProvider).MarkUserAsAuthenticated(loginModel.Email);
            _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", loginResult.Token);

            _tempService.CurrentUser = await _userRegistrationService.GetCurrent(loginModel.Email);

            User user = await _userManager.FindByEmailAsync(loginModel.Email);

            LogDTO logDTO = new LogDTO
            {
                Action = "Успешно авторизовался",
                UserId = user.Id
            };
            await _logService.AddLog(logDTO);

            return(loginResult);
        }
Ejemplo n.º 2
0
        public void InfoLog(string msg)
        {
            if (_appSettings.LogLevel == (int)AppLogLevel.Info)
            {
                msg = "Info:    " + msg;

                LogModel log = new LogModel();
                log.LogLevel = _appSettings.LogLevel;
                log.Message  = msg;
                _logService.AddLog(log);
            }
        }
        public void  Generate_Link([FromBody] string email)
        {
            string S = email;

            try
            {
                _reset.generate_link(email);
            }
            catch (Exception E)
            {
                _logger.AddLog(E.ToString(), E.GetType().ToString());
                //  return StatusCode(StatusCodes.Status400BadRequest);
            }
        }
Ejemplo n.º 4
0
        public IActionResult Post([FromBody] Employee employee)
        {
            if (!ModelState.IsValid)
            {
                _logger.AddLog(BadRequest(ModelState).ToString(), BadRequest().GetType().ToString());
                return(BadRequest(ModelState));
            }
            try
            {
                var doesExistAlready = _registerEmployee.IsEmpIdExist(employee.EmpId);
                if (doesExistAlready)
                {
                    return(StatusCode(StatusCodes.Status406NotAcceptable, "Employee ID exists"));
                }

                //Inside this post with image we are checking if this user.username (containing official email) already exists or not
                if (_registerEmployee.PostWithImage(employee) == true)
                {
                    _passwordResetService.GenerateAndSendEmail(employee.PersonalInfo.Email, employee.Username);
                    return(Ok());
                }
                return(BadRequest(ModelState));
            }
            catch (Exception E)
            {
                _logger.AddLog(E.ToString(), E.GetType().ToString());
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }
        }
Ejemplo n.º 5
0
 public (IList <Log>, int) Get(int page = 1, DateTime?startDate = null, DateTime?endDate = null, int limit = 50)
 {
     try
     {
         if (page < 0)
         {
             throw new IndexOutOfRangeException();
         }
     }
     catch (Exception E)
     {
         _log.AddLog(E.ToString(), E.GetType().ToString());
     }
     return(_log.GetAllLogs(page = 1, startDate, endDate, limit));
     //Note: Everything returned by controller has to be an ActionResult.
 }
Ejemplo n.º 6
0
 public string CreateTokenAuthentication(int userId)
 {
     try
     {
         string CacheName  = ProjectConst.TokenCacheName + userId;
         var    TokenKey   = Guid.NewGuid().ToString();
         long   ExpireDate = DateTime.Now.AddMinutes(ConfigManager.GetData(ProjectConst.TokenExpireTime).ToDouble()).ToLong();
         var    Entity     = new TokenAuthenticationEntity
         {
             UserId     = userId,
             ExpireDate = ExpireDate,
             TokenKey   = TokenKey
         };
         if (_redisManager.IsExsistByName <TokenAuthenticationEntity>(CacheName))
         {
             _redisManager.RemoveSingleByName <TokenAuthenticationEntity>(CacheName);
         }
         _redisManager.AddSingle(CacheName, Entity, DateTime.Now.AddMinutes(ConfigManager.GetData(ProjectConst.TokenCacheTime).ToDouble()));
         return(TokenKey);
     }
     catch (KnownException ex)
     {
         throw ex;
     }
     catch (Exception ex)
     {
         _logger.AddLog("", LogTypeEnum.Error, "AuthenticationManager.CreateTokenAuthentication", userId, ex.Message, "", ex);
         throw new KnownException(ErrorTypeEnum.GeneralExeption, ex.Message, ex);
     }
 }
 protected void LogMsg(string msg)
 {
     if (string.IsNullOrEmpty(msg) == false)
     {
         _logger.AddLog(msg);
     }
 }
Ejemplo n.º 8
0
        public IActionResult GetPagePermission(string role, string page)
        {
            bool result;

            try
            {
                result = _roleService.PageAccessAllowed(role, page);
            }
            catch (Exception E)
            {
                _logger.AddLog(E.ToString(), E.GetType().ToString());
                return(NotFound("Exception Occured."));
            }

            return(Ok(result));
        }
Ejemplo n.º 9
0
        public async Task Post([FromBody] LogEntryModel model)
        {
            var log = _mapper.Map <LogEntry>(model);

            log.Id   = 0;
            log.Date = DateTimeOffset.UtcNow;

            await _logService.AddLog(log, model.Key);
        }
Ejemplo n.º 10
0
        private async void SendNewMassage(string message)
        {
            var result = await ApplicationManager.SendNewMassageAsync(message);

            var logText = result.Success
                ? "Сообщение успешно доставлено."
                : result.Error;
            var logType = result.Success ? enLogType.Message : enLogType.Error;

            logService.AddLog(logText, logType);
        }
Ejemplo n.º 11
0
        public IActionResult GetByEmail([FromRoute] string email)
        {
            PersonalInfo personalInfo;

            try
            {
                //string email = "*****@*****.**";
                personalInfo = _personalInfoService.GetByEmail(email);
                if (personalInfo == null)
                {
                    return(NotFound("Record Not Found."));
                }
            }
            catch (Exception E)
            {
                _logger.AddLog(E.ToString(), E.GetType().ToString());
                return(NotFound("Exception Occured."));
            }

            return(Ok(personalInfo));
        }
        public async Task <ActionResult <LetterRequests> > PostUserLetterRequest([FromBody] LetterRequests letter)
        {
            if (!ModelState.IsValid)
            {
                _logger.AddLog(BadRequest(ModelState).ToString(), BadRequest().GetType().ToString());
                return(BadRequest(ModelState));
            }

            try
            {
                letter.DateCreated  = System.DateTime.Now;
                letter.DateModified = System.DateTime.Now;
                await _letterRequestService.PostLetterRequest(letter);
            }
            catch (Exception E)
            {
                _logger.AddLog(E.ToString(), E.GetType().ToString());
                return(StatusCode(StatusCodes.Status406NotAcceptable));
            }
            return(StatusCode(StatusCodes.Status201Created));
        }
Ejemplo n.º 13
0
        public async Task <IActionResult> Create(CreateOfferViewModel model)
        {
            if (this.ModelState.IsValid)
            {
                var tutor = await userManager.GetUserAsync(HttpContext.User);

                // TO DO: Enable File Uploading for images

                var dto = mapper.Map <CreateOfferViewModel, OfferDTO>(model);

                dto.TutorId = tutor.Id;
                int id = await this.offerService.AddOffer(dto);

                var result = await this.userManager.AddClaimAsync(tutor,
                                                                  new System.Security.Claims.Claim("Creator", id.ToString()));

                var log = new Log
                {
                    UserId       = this.userManager.GetUserId(HttpContext.User),
                    LogType      = LogType.CreatedAnOffer,
                    DateTime     = DateTime.Now,
                    ResourceId   = id,
                    ResourceType = ResourceType.Comment
                };
                await logService.AddLog(log);

                //return await Task.FromResult<IActionResult>(this.RedirectToRoute("Offer/Details/" + id));
                //this.TempData["Success"] = true;
                return(this.RedirectToAction("Details", "Offer", new { id = id }));
            }

            foreach (var error in this.ModelState.Values.SelectMany(p => p.Errors))
            {
                this.ViewData["Error"] += error + "/n";
            }

            CreateOfferViewModel createModel = CreateModel();

            return(await Task.Run(() => this.View(createModel)));
        }
Ejemplo n.º 14
0
        //调用中和接口向ERP系统插入订单
        public string AddOrder(Full_order_info_listItem OrderItem)
        {
            string           HttpResponse        = string.Empty;
            List <GoodsItem> ListGoodsItem       = new List <GoodsItem>();
            SortedDictionary <string, string> sb = new SortedDictionary <string, string>();

            //详细地址
            sb.Add("address", OrderItem.full_order_info.address_info.delivery_address);
            //市
            sb.Add("city", OrderItem.full_order_info.address_info.delivery_city);
            //商品信息
            foreach (var item in OrderItem.full_order_info.orders)
            {
                //取规格ID
                ListGoodsItem.Add(new GoodsItem {
                    item_id = orderService.QueryBarcode(item.outer_sku_id), qty = item.num, price = Convert.ToDouble(item.total_fee) / item.num
                });
            }
            string GoodsJson = JsonConvert.SerializeObject(ListGoodsItem);

            sb.Add("items", GoodsJson);
            //买家手机号
            sb.Add("mobile", OrderItem.full_order_info.address_info.receiver_tel);
            //创建时间
            sb.Add("order_created", OrderItem.full_order_info.order_info.pay_time);
            //订单号
            sb.Add("order_id", OrderItem.full_order_info.order_info.tid);
            //省
            sb.Add("province", OrderItem.full_order_info.address_info.delivery_province);
            //备注
            sb.Add("remark", OrderItem.full_order_info.remark_info.buyer_message);
            //收货人名称
            sb.Add("recevier", OrderItem.full_order_info.address_info.receiver_name);
            //收货人手机号
            sb.Add("tel", OrderItem.full_order_info.address_info.receiver_tel);
            //区
            sb.Add("town", OrderItem.full_order_info.address_info.delivery_district);
            string ordersJosonStr = HttpHepler.UrlResponseByPost("add_order", sb, appkey, appsecret);

            if (!string.IsNullOrEmpty(ordersJosonStr))
            {
                RootResponse rootModel = JsonConvert.DeserializeObject <RootResponse>(ordersJosonStr);
                if (rootModel.Code == "0")
                {
                    return(rootModel.AddOrderResponse.ERPORDERID);
                }
                logService.AddLog("有赞订单号:" + OrderItem.full_order_info.order_info.tid + "  收件人信息" + OrderItem.full_order_info.address_info.receiver_name + OrderItem.full_order_info.address_info.receiver_tel + " 地址:" + OrderItem.full_order_info.address_info.delivery_province + OrderItem.full_order_info.address_info.delivery_city + OrderItem.full_order_info.address_info.delivery_district + OrderItem.full_order_info.address_info.delivery_address + " 错误信息:" + rootModel.ErrorMessage.Trim());
            }
            return(null);
        }
Ejemplo n.º 15
0
        public void Log(string logName, int moduleId, string moduleName, string errorMsg, string errorStack, string extraData)
        {
            var log = new Sys_Log();

            log.LogId       = Guid.NewGuid().ToString();
            log.LogName     = logName;
            log.ModuleId    = moduleId;
            log.ModuleName  = moduleName;
            log.ErrorMsg    = errorMsg;
            log.ErrorStack  = errorStack;
            log.ExtraData   = extraData;
            log.CreatedDate = DateTime.Now;

            _logService.AddLog(log);
        }
Ejemplo n.º 16
0
        public async Task <IActionResult> OnPost()
        {
            var principal         = HttpContext.User as ClaimsPrincipal;
            var accessUserIdClaim = principal?.Claims.FirstOrDefault(c => c.Type == "Id");

            if (accessUserIdClaim == null)
            {
                return(BadRequest());
            }

            Log.CreatedByUserId = int.Parse(accessUserIdClaim.Value);

            await _logService.AddLog(Log);

            return(RedirectToPage("../Log"));
        }
Ejemplo n.º 17
0
 //调用ZH接口发送增加订单
 public string AddOrder(BbOrder orderItem)
 {
     try
     {
         List <GoodsItem> listGoodsItem       = new List <GoodsItem>();
         SortedDictionary <string, string> sb = new SortedDictionary <string, string>();
         sb.Add("address", orderItem.Address);
         sb.Add("city", orderItem.City);
         foreach (var item in orderItem.Item)
         {
             listGoodsItem.Add(new GoodsItem
             {
                 item_id = orderService.QueryBarcode(item.Outer_id),
                 qty     = Convert.ToInt32(item.Num),
                 price   = Convert.ToDouble(item.Total_fee / Convert.ToInt32(item.Num))
             });
         }
         string goodsJson = CommonHelper.ToJson(listGoodsItem);
         sb.Add("items", goodsJson);
         sb.Add("mobile", orderItem.Receiver_phone);
         sb.Add("order_created", orderItem.Pay_time);
         sb.Add("order_id", orderItem.Oid);
         sb.Add("province", orderItem.Province);
         sb.Add("remark", orderItem.Remark);
         sb.Add("recevier", orderItem.Receiver_name);
         sb.Add("tel", orderItem.Receiver_phone);
         sb.Add("town", orderItem.County);
         string ordersJosonStr = HttpHepler.UrlResponseByPost("add_order", sb, appkey, appsecret);
         if (!string.IsNullOrEmpty(ordersJosonStr))
         {
             RootResponse rootModel = CommonHelper.DeJson <RootResponse>(ordersJosonStr);
             if (rootModel.Code == "0")
             {
                 return(rootModel.AddOrderResponse.ERPORDERID);
             }
             logService.AddLog("贝店订单号:" + orderItem.Oid + "  收件人信息:" + orderItem.Receiver_name + orderItem.Receiver_phone + "  地址:" + orderItem.Province + orderItem.City + orderItem.County + orderItem.Address + " 错误信息:" + rootModel.ErrorMessage.Trim());
             log.Error(rootModel.ErrorMessage);
         }
         return(null);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
        public IActionResult GetPaginatedEmployeeLetterRequests(int empId, int page = 1, string sort = "Id", string search = "", int limit = 10, bool sortOrder = false, string searchInColumn = "none", string thenSearchFor = "")

        {
            // EmpID less than 1 will result in returning all values
            try
            {
                IList <TrainingRequest> employeeTrainingRequests = _trainingRequestService.GetPaginatedEmployeeTrainingRequests(empId, page, sort, search, limit, sortOrder, searchInColumn, thenSearchFor);
                if (employeeTrainingRequests == null)
                {
                    return(NotFound($"No Training Exists for employee Id: {empId}"));
                }
                return(Ok(employeeTrainingRequests));
            }
            catch (Exception E)
            {
                _log.AddLog(E.ToString(), E.GetType().ToString());
                return(NotFound(E.ToString()));
            }
        }
Ejemplo n.º 19
0
        public async Task InvokeAsync(HttpContext context, ILogService logService)
        {
            if (context.Request.Path.HasValue)
            {
                var log = new Log();
                log.RequestPath        = context.Request.Path.Value.ToString();
                log.RequestMethod      = context.Request.Method.ToString();
                log.TraceIdentifier    = context.TraceIdentifier.ToString();
                log.UserAgent          = context.Request.Headers["User-Agent"].ToString();
                log.IPAddress          = context.Connection.RemoteIpAddress.ToString();
                log.RoutePath          = context.Request.QueryString.Value.ToString();
                log.ResponseStatusCode = context.Response.StatusCode.ToString();
                log.CreateDate         = DateTime.Now;

                logService.AddLog(log);


                await _next(context);
            }
        }
Ejemplo n.º 20
0
        public void Intercept(IInvocation invocation)
        {
            var models = invocation.Arguments.Where(Ext.IsAttributeType <FunctionAttribute>);

            var selectMany = models.SelectMany(x => x.GetType().GetPropertiesBy <FieldAttribute>(),
                                               (model, prop) => new
            {
                CurrentValue = prop.GetValue(model),
                FieldName    = prop.GetAttributeValue((FieldAttribute z) => z.Name),
                functionName = model.GetType()
                               .GetAttributeValue((FunctionAttribute attr) => attr.Name)
            });

            foreach (var prop in selectMany)
            {
                var lastLog = _logService.GetLastLog(new LogFilter()
                {
                    FieldName    = prop.FieldName,
                    FunctionName = prop.functionName
                });

                var logModel = new LogModel()
                {
                    UserCode     = "Dnaiel",
                    FunctionName = prop.functionName,
                    FieldName    = prop.FieldName,
                    NewValue     = prop.CurrentValue?.ToString()
                };

                if (lastLog != null)
                {
                    logModel.OldValue = lastLog.NewValue;
                }
                else
                {
                    logModel.OldValue = string.Empty;
                }

                _logService.AddLog(logModel);
            }
        }
Ejemplo n.º 21
0
        public IActionResult GetCertifications(int EmpId)
        {
            IEnumerable <Certification> _certificationList = null;

            try
            {
                _certificationList = _certficateService.GetAll(EmpId);
                if (_certificationList == null)
                {
                    return(NotFound($"No Record Found against Employee Id: {EmpId}"));
                }
            }
            catch (Exception E)
            {
                _logger.AddLog(E.ToString(), E.GetType().ToString());
                return(NotFound("Exception Occured."));
            }
            return(Ok(_certificationList));
        }
Ejemplo n.º 22
0
        public void OnActionExecuted(ActionExecutedContext filterContext)
        {
            var    UserName = filterContext.HttpContext.User.Identity.Name;
            var    URL      = filterContext.HttpContext.Request.RawUrl;
            var    Browser  = filterContext.HttpContext.Request.Browser;
            var    exeption = filterContext.Exception;
            LogDTO l        = new LogDTO
            {
                UserName         = UserName == "" ? "-" : UserName,
                BrowserName      = Browser.Browser,
                BrowserVersion   = Browser.MinorVersionString,
                JavasriptVersion = Browser.JScriptVersion.ToString(),
                IsMobile         = Browser.IsMobileDevice,
                Platform         = Browser.Platform,
                Exeption         = exeption is null ? "-" : exeption.Message,
                URL  = URL,
                Date = DateTime.Now
            };

            logService.AddLog(l);
        }
Ejemplo n.º 23
0
        public async Task <IActionResult> Add(int id, [FromForm] AddCommentViewModel model)
        {
            // TODO: Add TRY CATCH BLOCK

            if (ModelState.IsValid)
            {
                try
                {
                    model.PublishDate = DateTime.Now;
                    var dto = mapper.Map <AddCommentViewModel, CommentDTO>(model);
                    dto.CommenterId     = (await this.userManager.GetUserAsync(User)).Id;
                    dto.PublicationDate = DateTime.Now;
                    var result = await this.commentService.AddComment(dto);

                    var log = new Log
                    {
                        UserId       = dto.CommenterId,
                        LogType      = LogType.AddedAComment,
                        DateTime     = DateTime.Now,
                        ResourceId   = result,
                        ResourceType = ResourceType.Comment
                    };
                    int logId = await logService.AddLog(log);

                    //this.TempData["Success"] = Constants.Message.SuccessfulComment;
                    return(this.RedirectToAction("Details", "Offer", new { Id = model.OfferId }));
                }
                catch
                {
                    ModelState.AddModelError("error", "Вашият коментар не успя да бъде записан.");
                    return(await Task.Run(() => this.RedirectToAction("Details", "Offer", new { Id = model.OfferId })));
                }
            }
            else
            {
                ModelState.AddModelError("error", "there was an error");
                return(await Task.Run(() => this.RedirectToAction("Details", "Offer", new { Id = model.OfferId })));
            }
        }
Ejemplo n.º 24
0
        /// <summary>
        /// 修改权值
        /// </summary>
        /// <param name="food_name"></param>
        /// <param name="reason"></param>
        public void ChangeWeight(String food_name, List <int> reason, bool IsWriteToJson)
        {
            // reason 0 冷
            // reason 1 一般
            // reason 2 热
            // reason 3 干
            // reason 4 正常
            // reason 5 湿

            int pos = FindNameIndex(food_name);

            for (int i = 0; i < reason.Count; i++)
            {
                if (reason[i] > 0)
                {
                    foodInformationList[pos].Weight[i] =
                        Convert.ToInt32(Math.Ceiling(Convert.ToDouble(foodInformationList[pos].Weight[i] * (Math.Pow(4, reason[i]) / (Math.Pow(3, reason[i]))))));
                }
                else if (reason[i] < 0)
                {
                    int absNum = Math.Abs(reason[i]);
                    foodInformationList[pos].Weight[i] =
                        Convert.ToInt32(Math.Ceiling(Convert.ToDouble(foodInformationList[pos].Weight[i] * (Math.Pow(3, absNum) / (Math.Pow(4, absNum))))));
                }
            }

            if (IsWriteToJson)
            {
                Log log = new Log();
                log.FoodName    = food_name;
                log.Date        = DateTime.Now;
                log.WeatherList = new List <int>(2);
                log.WeatherList.Add((int)(weatherStatus.Temperature));
                log.WeatherList.Add((int)(weatherStatus.Temperature));
                log.WeightChangeList = reason;
                _logService.AddLog(log);
                _foodFavorService.ChangeWeight(pos, reason);
            }
        }
Ejemplo n.º 25
0
 public ActionResult Rent(string userId, string carId, string orderTime)
 {
     try
     {
         //生成租车订单
         if (!(String.IsNullOrWhiteSpace(userId)) && !(String.IsNullOrWhiteSpace(carId)))
         {
             User info     = new User();
             User userbase = User_Manager.selectUser(info);
             //判断是否有租车权限,没有则跳转到其他页面
             if (Commons.NORMAL_USER.Equals(userbase.PhoneNumber) || Commons.COMPANY_USER.Equals(userbase.CardPath))
             {
                 // user.rentCar(userbase, carId, orderTime);
                 //输出订单记录
                 Log order = new Log();
                 _logService.AddLog(order);
             }
         }
     }
     catch {
     }
     return(View());
 }
        public async Task <IActionResult> GetGrievanceTypes()
        {
            IEnumerable <GrievanceTypes> AllGrievanceTypes = new List <GrievanceTypes>();

            try
            {
                AllGrievanceTypes = await _grievanceTypeService.GetAll();

                if (AllGrievanceTypes == null)
                {
                    return(NotFound($"No Record Found"));
                }
            }
            catch (Exception ex)
            {
                _logger.AddLog(ex.ToString(), ex.GetType().ToString());
                return(NotFound("Exception Occured."));
            }

            return(Ok(AllGrievanceTypes));
        }
 public void OnException(ExceptionContext context)
 {
     _logService.AddLog("77");
     throw new NotImplementedException();
 }
Ejemplo n.º 28
0
        public ActionResult Create(CreateRequestModel model)
        {
            var valid     = true;
            var addresses = new List <string>();

            if (model.Errors == null)
            {
                model.Errors = new List <string>();
            }

            if (model.Request.DepartureAddress == "" && model.Request.DeparturePointId == 0)
            {
                model.Errors.Add("Укажите адрес отправления");
                valid = false;
            }

            if (model.Request.DestinationAddress == "" && model.Request.DestinationPointId == 0)
            {
                model.Errors.Add("Укажите адрес назначения");
                valid = false;
            }

            //TODO сделать валидацию даты времени отправления

            if (!valid)
            {
                var poiList = _locationService.GetPOIList();
                model.POIList          = new SelectList(poiList, "Id", "Name");
                model.POIListAddresses = new SelectList(poiList, "Id", "Address");

                return(View(model));
            }

            var    mileageService = new MileageCalculatingService();
            string calcDestinationAddress;
            string calcDepartureAddress;

            if (model.Request.DestinationPointId == 0)
            {
                calcDestinationAddress = model.Request.DestinationAddress;
            }
            else
            {
                calcDestinationAddress = _locationService.GetPOIById(model.Request.DestinationPointId).Address;
            }

            if (model.Request.DeparturePointId == 0)
            {
                calcDepartureAddress = model.Request.DepartureAddress;
            }
            else
            {
                calcDepartureAddress = _locationService.GetPOIById(model.Request.DeparturePointId).Address;
            }

            model.Request.Mileage = mileageService.GetMileage(calcDepartureAddress, calcDestinationAddress);


            model.Request.AuthorLogin = User.Identity.Name;
            var error = "";

            if (!_requestService.AddRequest(model.Request, out error))
            {
                model.Errors.Add(error);
                var poiList = _locationService.GetPOIList();
                model.POIList          = new SelectList(poiList, "Id", "Name");
                model.POIListAddresses = new SelectList(poiList, "Id", "Address");
                return(View(model));
            }

            var userId = _userService.GetUserByMail(HttpContext.User.Identity.Name).Id;

            var newLog = new DtoLog()
            {
                CreatorFirstName = _employeeService.GetUserLastName(userId).Firstname,
                CreatorLastName  = _employeeService.GetUserLastName(userId).Lastname,
                BrowserName      = HttpContext.Request.Browser.Browser,
                IpAddress        = HttpContext.Request.UserHostAddress,
                RequestMile      = model.Request.Mileage,
                RequestPrice     = 10
            };

            _logService.AddLog(newLog, out error);

            return(RedirectToAction("Index", "Request"));
        }
Ejemplo n.º 29
0
 public string GetPwd(string username)
 {
     logservice.AddLog("getPwd" + username);
     return("666");
 }
Ejemplo n.º 30
0
        public async Task InvokeAsync(HttpContext context, ILogService logService)
        {
            logService.AddLog(context);

            await _next(context);
        }