public ActionResult ConfirmAbortOrder(int?id) { if (id != null) { bool result = _orderService.ConfirmAbortOrder(id.Value, User.Identity.GetUserId()); var order = _orderService.GetOrder(id.Value, i => i.Seller.ApplicationUser, i => i.Buyer.ApplicationUser, i => i.CurrentStatus); if (result && order != null) { if (order.JobId != null) { BackgroundJob.Delete(order.JobId); order.JobId = null; } _orderService.SaveOrder(); if (Request.Url != null) { MarketHangfire.SetSendEmailChangeStatus(order.Id, order.Seller.ApplicationUser.Email, order.CurrentStatus.DuringName, Url.Action("SellDetails", "Order", new { id = order.Id }, protocol: Request.Url.Scheme)); MarketHangfire.SetSendEmailChangeStatus(order.Id, order.Buyer.ApplicationUser.Email, order.CurrentStatus.DuringName, Url.Action("BuyDetails", "Order", new { id = order.Id }, protocol: Request.Url.Scheme)); } _orderService.SaveOrder(); return(RedirectToAction("BuyDetails", "Order", new { id })); } } return(HttpNotFound()); }
public ActionResult ConfirmOrder(int?id) { if (id != null) { bool result = _orderService.ConfirmOrder(id.Value, User.Identity.GetUserId()); var order = _orderService.GetOrder(id.Value, i => i.CurrentStatus, i => i.Seller.ApplicationUser, i => i.Buyer.ApplicationUser); if (result && order != null) { if (order.JobId != null) { BackgroundJob.Delete(order.JobId); order.JobId = null; } _orderService.SaveOrder(); order.JobId = MarketHangfire.SetLeaveFeedbackJob(order.SellerId, order.BuyerId, order.Id, TimeSpan.FromDays(15)); MarketHangfire.SetSendEmailChangeStatus(order.Id, order.Seller.ApplicationUser.Email, order.CurrentStatus.DuringName, Url.Action("SellDetails", "Order", new { id = order.Id }, protocol: Request.Url.Scheme)); MarketHangfire.SetSendEmailChangeStatus(order.Id, order.Buyer.ApplicationUser.Email, order.CurrentStatus.DuringName, Url.Action("BuyDetails", "Order", new { id = order.Id }, protocol: Request.Url.Scheme)); _orderService.SaveOrder(); TempData["orderBuyStatus"] = "Спасибо за подтверждение сделки! Сделка успешно закрыта."; return(RedirectToAction("BuyDetails", "Order", new { id })); } } return(HttpNotFound()); }
public void Configuration(IAppBuilder app) { ConfigureAuth(app); MarketHangfire.ConfigureHangfire(app); GlobalConfiguration.Configuration .UseSqlServerStorage("MarketEntities"); //JobHelper.SetSerializerSettings(new Newtonsoft.Json.JsonSerializerSettings() { ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore }); app.UseHangfireDashboard("/hangfire", new DashboardOptions { Authorization = new[] { new MyAuthorizationFilter() } }); app.UseHangfireServer(); //app.UseCookieAuthentication(new CookieAuthenticationOptions //{ // AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, // LoginPath = new PathString("/Account/Login"), //}); CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("ru"); app.MapSignalR(); }
public ActionResult ProvideDataToBuyer(AccountInfoViewModel model) { if (ModelState.IsValid) { var accountInfo = Mapper.Map <AccountInfoViewModel, AccountInfo>(model); var buyerOrder = _orderService.GetOrder(model.SteamLogin, model.ModeratorId, model.SellerId, model.BuyerId, i => i.CurrentStatus, i => i.StatusLogs, i => i.AccountInfos, i => i.Seller.ApplicationUser, i => i.Buyer.ApplicationUser); if (buyerOrder?.CurrentStatus != null) { if (buyerOrder.CurrentStatus.Value == OrderStatuses.MidddlemanChecking) { buyerOrder.StatusLogs.AddLast(new StatusLog() { OldStatus = buyerOrder.CurrentStatus, NewStatus = _orderStatusService.GetOrderStatusByValue(OrderStatuses.BuyerConfirming), TimeStamp = DateTime.Now }); buyerOrder.CurrentStatus = _orderStatusService.GetOrderStatusByValue(OrderStatuses.BuyerConfirming); buyerOrder.BuyerChecked = false; buyerOrder.SellerChecked = false; buyerOrder.AccountInfos.Add(accountInfo); _accountInfoService.CreateAccountInfo(accountInfo); if (buyerOrder.JobId != null) { BackgroundJob.Delete(buyerOrder.JobId); buyerOrder.JobId = null; } _orderService.SaveOrder(); buyerOrder.JobId = MarketHangfire.SetConfirmOrderJob(buyerOrder.Id, TimeSpan.FromDays(2)); if (Request.Url != null) { MarketHangfire.SetSendEmailChangeStatus(buyerOrder.Id, buyerOrder.Seller.ApplicationUser.Email, buyerOrder.CurrentStatus.DuringName, Url.Action("SellDetails", "Order", new { id = buyerOrder.Id }, protocol: Request.Url.Scheme)); MarketHangfire.SetSendEmailAccountData(accountInfo.Login, accountInfo.Password, accountInfo.Email, accountInfo.EmailPassword, accountInfo.AdditionalInformation, buyerOrder.Buyer.ApplicationUser.Email); } _orderService.SaveOrder(); return(RedirectToAction("ProvideDataToBuyer", new { orderId = buyerOrder.Id })); } } } return(HttpNotFound()); }
public ActionResult ProcessOrder(int?id) { if (id != null) { var order = _orderService.GetOrder(id.Value, i => i.CurrentStatus, i => i.Seller.ApplicationUser, i => i.Buyer.ApplicationUser, i => i.StatusLogs); if (order.CurrentStatus != null) { if (order.CurrentStatus.Value == OrderStatuses.MiddlemanFinding) { order.StatusLogs.AddLast(new StatusLog() { OldStatus = order.CurrentStatus, NewStatus = _orderStatusService.GetOrderStatusByValue(OrderStatuses.SellerProviding), TimeStamp = DateTime.Now }); order.CurrentStatus = _orderStatusService.GetOrderStatusByValue(OrderStatuses.SellerProviding); order.BuyerChecked = false; order.SellerChecked = false; order.MiddlemanId = User.Identity.GetUserId(); if (order.JobId != null) { BackgroundJob.Delete(order.JobId); order.JobId = null; } _orderService.SaveOrder(); order.JobId = MarketHangfire.SetOrderCloseJob(order.Id, TimeSpan.FromDays(1)); if (Request.Url != null) { MarketHangfire.SetSendEmailChangeStatus(order.Id, order.Seller.ApplicationUser.Email, order.CurrentStatus.DuringName, Url.Action("SellDetails", "Order", new { id = order.Id }, protocol: Request.Url.Scheme)); MarketHangfire.SetSendEmailChangeStatus(order.Id, order.Buyer.ApplicationUser.Email, order.CurrentStatus.DuringName, Url.Action("BuyDetails", "Order", new { id = order.Id }, protocol: Request.Url.Scheme)); } _orderService.SaveOrder(); return(RedirectToAction("MyOrderList")); } } } return(HttpNotFound()); }
public ActionResult Activate(int?id = 1) { if (id != null) { var offer = _offerService.GetOffers(o => o.Id == id.Value, o => o.UserProfile).SingleOrDefault(); if (offer != null && offer.UserProfileId == User.Identity.GetUserId() && offer.State == OfferState.inactive) { offer.State = OfferState.active; offer.DateCreated = DateTime.Now; offer.DateDeleted = offer.DateCreated.AddDays(offerDays); _offerService.SaveOffer(); if (Request.Url != null) { offer.JobId = MarketHangfire.SetDeactivateOfferJob(offer.Id, Url.Action("Activate", "Offer", new { id = offer.Id }, Request.Url.Scheme), TimeSpan.FromDays(30)); } _offerService.SaveOffer(); return(View()); } } return(HttpNotFound()); }
public ActionResult ProvideData(AccountInfoViewModel model) { if (ModelState.IsValid) { var accountInfo = Mapper.Map <AccountInfoViewModel, AccountInfo>(model); var moderator = _userProfileService.GetUserProfile(u => u.Id == model.ModeratorId, i => i.ApplicationUser); bool moderIsInrole = false; if (moderator != null) { foreach (var role in moderator.ApplicationUser.Roles) { if (role.RoleId == "2" && role.UserId == moderator.Id) { moderIsInrole = true; } } } if (moderIsInrole) { var order = _orderService.GetOrder(model.SteamLogin, model.ModeratorId, model.SellerId, model.BuyerId, i => i.CurrentStatus, i => i.StatusLogs, i => i.Seller.ApplicationUser, i => i.Buyer.ApplicationUser); if (order != null) { if (order.CurrentStatus != null) { if (order.CurrentStatus.Value == OrderStatuses.SellerProviding) { order.StatusLogs.AddLast(new StatusLog() { OldStatus = order.CurrentStatus, NewStatus = _orderStatusService.GetOrderStatusByValue(OrderStatuses.MidddlemanChecking), TimeStamp = DateTime.Now }); order.CurrentStatus = _orderStatusService.GetOrderStatusByValue(OrderStatuses.MidddlemanChecking); order.BuyerChecked = false; order.SellerChecked = false; accountInfo.Order = order; _accountInfoService.CreateAccountInfo(accountInfo); if (order.JobId != null) { BackgroundJob.Delete(order.JobId); order.JobId = null; } //order.JobId = MarketHangfire.SetOrderCloseJob(order.Id, TimeSpan.FromMinutes(5)); _orderService.SaveOrder(); MarketHangfire.SetSendEmailChangeStatus(order.Id, order.Seller.ApplicationUser.Email, order.CurrentStatus.DuringName, Url.Action("SellDetails", "Order", new { id = order.Id }, protocol: Request.Url.Scheme)); MarketHangfire.SetSendEmailChangeStatus(order.Id, order.Buyer.ApplicationUser.Email, order.CurrentStatus.DuringName, Url.Action("BuyDetails", "Order", new { id = order.Id }, protocol: Request.Url.Scheme)); TempData["orderSellStatus"] = "Ваши данные были отправлены на проверку гаранту"; return(RedirectToAction("SellDetails", "Order", new { id = order.Id })); } } } } } return(HttpNotFound()); }
public void MoneyIn() { var secretKey = "fVdVZaZjAkkd8h3A"; var pars = new SortedDictionary <string, string>(); var keys = Request.Form.AllKeys; foreach (var key in keys.Where(key => key.IndexOf("ik_") >= 0 && key != "ik_sign")) { pars.Add(key, Request.Form[key]); } var hash = string.Join(":", pars.Select(x => x.Value).ToArray().Concat(new[] { secretKey })); var md5 = new MD5CryptoServiceProvider(); var isSame = Convert.ToBase64String(md5.ComputeHash(Encoding.UTF8.GetBytes(hash))) == Request.Form["ik_sign"]; bool isOrderPay = false; if (isSame) { var userId = Request.Form["ik_x_user_id"]; var offerId = Request.Form["ik_x_offer_id"]; var mainCup = _userProfileService.GetUserProfileByName("palyerup"); if (offerId != null && userId != null && mainCup != null) { var user = _userProfileService.GetUserProfile(u => u.Id == userId, i => i.ApplicationUser); Offer offer = _offerService.GetOffer(int.Parse(offerId), o => o.UserProfile, o => o.UserProfile.ApplicationUser, o => o.Order, o => o.Order.StatusLogs, o => o.Order.CurrentStatus); decimal buyerPay = 0; if (offer.SellerPaysMiddleman) { buyerPay = offer.Price; } else { buyerPay = offer.Price + offer.MiddlemanPrice.Value; } if (buyerPay == Decimal.Parse(Request.Form["ik_am"])) { if (offer != null && offer.UserProfile.Id != User.Identity.GetUserId()) { offer.Order = new Order { Buyer = user, Seller = offer.UserProfile, DateCreated = DateTime.Now }; Order order = offer.Order; offer.State = OfferState.closed; order.StatusLogs.AddLast(new StatusLog() { OldStatus = _orderStatusService.GetOrderStatusByValue(OrderStatuses.OrderCreating), NewStatus = _orderStatusService.GetOrderStatusByValue(OrderStatuses.BuyerPaying), TimeStamp = DateTime.Now }); order.StatusLogs.AddLast(new StatusLog() { OldStatus = _orderStatusService.GetOrderStatusByValue(OrderStatuses.BuyerPaying), NewStatus = _orderStatusService.GetOrderStatusByValue(OrderStatuses.MiddlemanFinding), TimeStamp = DateTime.Now }); order.CurrentStatus = _orderStatusService.GetOrderStatusByValue(OrderStatuses.MiddlemanFinding); _transactionService.CreateTransaction(new Transaction { Amount = buyerPay, Order = order, Receiver = mainCup, Sender = user, TransactionDate = DateTime.Now }); if (offer.JobId != null) { BackgroundJob.Delete(offer.JobId); offer.JobId = null; } _offerService.SaveOffer(); isOrderPay = true; MarketHangfire.SetSendEmailChangeStatus(order.Id, offer.UserProfile.ApplicationUser.Email, order.CurrentStatus.DuringName, Url.Action("SellDetails", "Order", new { id = order.Id }, protocol: Request.Url.Scheme)); MarketHangfire.SetSendEmailChangeStatus(order.Id, user.ApplicationUser.Email, order.CurrentStatus.DuringName, Url.Action("BuyDetails", "Order", new { id = order.Id }, protocol: Request.Url.Scheme)); offer.Order.JobId = MarketHangfire.SetOrderCloseJob(order.Id, TimeSpan.FromDays(1)); _orderService.SaveOrder(); } } } // если пополняем баланс if (userId != null && !isOrderPay) { var user = _userProfileService.GetUserProfile(u => u.Id == userId); var amount = Decimal.Parse(Request.Form["ik_am"]); user.Balance += amount; _billingService.CreateBilling(new Billing { User = user, DateCeated = DateTime.Now, Amount = amount }); _userProfileService.SaveUserProfile(); } else if (!isOrderPay) { string currentUserId = User.Identity.GetUserId(); var currentUser = _userProfileService.GetUserProfileById(currentUserId); if (currentUser != null) { var amount = Decimal.Parse(Request.Form["ik_am"]); currentUser.Balance += amount; _billingService.CreateBilling(new Billing { User = currentUser, DateCeated = DateTime.Now, Amount = amount }); _userProfileService.SaveUserProfile(); } } } }
public async Task <ActionResult> Checkoutme(CheckoutViewModel model) { //UserProfile buyer = _db.UserProfiles.Get(User.Identity.GetUserId()); Offer offer = _offerService.GetOffer(model.OfferId, o => o.UserProfile, o => o.UserProfile.ApplicationUser, o => o.Order, o => o.Order.StatusLogs, o => o.Order.CurrentStatus); if (offer != null && offer.Order == null && offer.State == OfferState.active && offer.UserProfileId != User.Identity.GetUserId()) { var currentUserId = User.Identity.GetUserId(); var user = _userProfileService.GetUserProfile(u => u.Id == currentUserId, i => i.ApplicationUser); var mainCup = _userProfileService.GetUserProfileByName("palyerup"); if (user != null && mainCup != null && user.Balance >= model.OrderSum) { //var amount = Decimal.Parse(Request.Form["ik_am"]); offer.Order = new Order { BuyerId = currentUserId, SellerId = offer.UserProfileId, DateCreated = DateTime.Now }; offer.State = OfferState.closed; if (mainCup != null) { var seller = offer.UserProfile; var buyer = user; if (offer.SellerPaysMiddleman) { offer.Order.Sum = offer.Price; offer.Order.AmmountSellerGet = offer.Price - offer.MiddlemanPrice.Value; if (buyer.Balance >= offer.Order.Sum) { _transactionService.CreateTransaction(new Transaction { Amount = offer.Order.Sum, Order = offer.Order, Receiver = mainCup, Sender = buyer, TransactionDate = DateTime.Now }); buyer.Balance -= offer.Order.Sum; mainCup.Balance += offer.Order.Sum; } else { return(View("NotEnoughMoney")); } } else { offer.Order.Sum = offer.Price + offer.MiddlemanPrice.Value; offer.Order.AmmountSellerGet = offer.Price; if (buyer.Balance >= offer.Order.Sum) { _transactionService.CreateTransaction(new Transaction { Amount = offer.Order.Sum, Order = offer.Order, Receiver = mainCup, Sender = buyer, TransactionDate = DateTime.Now }); buyer.Balance -= offer.Order.Sum; mainCup.Balance += offer.Order.Sum; } else { return(View("NotEnoughMoney")); } } offer.Order.StatusLogs.AddLast(new StatusLog() { OldStatus = _orderStatusService.GetOrderStatusByValue(OrderStatuses.OrderCreating), NewStatus = _orderStatusService.GetOrderStatusByValue(OrderStatuses.BuyerPaying), TimeStamp = DateTime.Now }); offer.Order.StatusLogs.AddLast(new StatusLog() { OldStatus = _orderStatusService.GetOrderStatusByValue(OrderStatuses.BuyerPaying), NewStatus = _orderStatusService.GetOrderStatusByValue(OrderStatuses.MiddlemanFinding), TimeStamp = DateTime.Now }); offer.Order.CurrentStatus = _orderStatusService.GetOrderStatusByValue(OrderStatuses.MiddlemanFinding); offer.Order.BuyerChecked = false; offer.Order.SellerChecked = false; if (offer.Order.JobId != null) { BackgroundJob.Delete(offer.Order.JobId); offer.Order.JobId = null; } if (offer.JobId != null) { BackgroundJob.Delete(offer.JobId); offer.JobId = null; } _orderService.SaveOrder(); MarketHangfire.SetSendEmailChangeStatus(offer.Order.Id, seller.ApplicationUser.Email, offer.Order.CurrentStatus.DuringName, Url.Action("SellDetails", "Order", new { id = offer.Order.Id }, protocol: Request.Url.Scheme)); MarketHangfire.SetSendEmailChangeStatus(offer.Order.Id, buyer.ApplicationUser.Email, offer.Order.CurrentStatus.DuringName, Url.Action("BuyDetails", "Order", new { id = offer.Order.Id }, protocol: Request.Url.Scheme)); offer.Order.JobId = MarketHangfire.SetOrderCloseJob(offer.Order.Id, TimeSpan.FromDays(1)); //_orderService.UpdateOrder(order); _orderService.SaveOrder(); TempData["orderBuyStatus"] = "Оплата прошла успешно"; return(RedirectToAction("BuyDetails", "Order", new { id = offer.Order.Id })); } } } return(HttpNotFound()); }
public ActionResult Close(int?Id) { string userId = User.Identity.GetUserId(); if (userId != null && Id != null) { var order = _orderService.GetOrder(Id.Value, i => i.Seller, i => i.Seller.ApplicationUser, i => i.Buyer.ApplicationUser, i => i.CurrentStatus, i => i.Buyer, i => i.Middleman, i => i.Seller); bool closeResult = false; if (order != null) { if (userId == order.BuyerId) { closeResult = _orderService.CloseOrderByBuyer(order.Id); if (closeResult) { if (order.JobId != null) { BackgroundJob.Delete(order.JobId); order.JobId = null; } TempData["orderBuyStatus"] = "Сделка закрыта."; _orderService.SaveOrder(); MarketHangfire.SetSendEmailChangeStatus(order.Id, order.Seller.ApplicationUser.Email, order.CurrentStatus.DuringName, Url.Action("SellDetails", "Order", new { id = order.Id }, protocol: Request.Url.Scheme)); MarketHangfire.SetSendEmailChangeStatus(order.Id, order.Buyer.ApplicationUser.Email, order.CurrentStatus.DuringName, Url.Action("BuyDetails", "Order", new { id = order.Id }, protocol: Request.Url.Scheme)); return(RedirectToAction("BuyDetails", new { id = order.Id })); } } else if (userId == order.SellerId) { closeResult = _orderService.CloseOrderBySeller(order.Id); if (closeResult) { if (order.JobId != null) { BackgroundJob.Delete(order.JobId); order.JobId = null; } TempData["orderSellStatus"] = "Сделка закрыта."; _orderService.SaveOrder(); MarketHangfire.SetSendEmailChangeStatus(order.Id, order.Seller.ApplicationUser.Email, order.CurrentStatus.DuringName, Url.Action("SellDetails", "Order", new { id = order.Id }, protocol: Request.Url.Scheme)); MarketHangfire.SetSendEmailChangeStatus(order.Id, order.Buyer.ApplicationUser.Email, order.CurrentStatus.DuringName, Url.Action("BuyDetails", "Order", new { id = order.Id }, protocol: Request.Url.Scheme)); return(RedirectToAction("SellDetails", new { id = order.Id })); } } else if (userId == order.MiddlemanId) { closeResult = _orderService.CloseOrderByMiddleman(order.Id); if (closeResult) { if (order.JobId != null) { BackgroundJob.Delete(order.JobId); order.JobId = null; } _orderService.SaveOrder(); MarketHangfire.SetSendEmailChangeStatus(order.Id, order.Seller.ApplicationUser.Email, order.CurrentStatus.DuringName, Url.Action("SellDetails", "Order", new { id = order.Id }, protocol: Request.Url.Scheme)); MarketHangfire.SetSendEmailChangeStatus(order.Id, order.Buyer.ApplicationUser.Email, order.CurrentStatus.DuringName, Url.Action("BuyDetails", "Order", new { id = order.Id }, protocol: Request.Url.Scheme)); } } if (order.BuyerId == userId) { return(RedirectToAction("BuyDetails", "Order", new { id = order.Id })); } else if (order.SellerId == userId) { return(RedirectToAction("SellDetails", "Order", new { id = order.Id })); } } } return(HttpNotFound()); }
public async System.Threading.Tasks.Task <ActionResult> Create(CreateOfferViewModel model, HttpPostedFileBase[] images) { Tinify.Key = ConfigurationManager.AppSettings["TINYPNG_APIKEY"]; if (!ModelState.IsValid) { return(View(model)); } var currentUserId = User.Identity.GetUserId(); var userProfile = _userProfileService.GetUserProfiles(u => u.Id == currentUserId, i => i.ApplicationUser).SingleOrDefault(); if (userProfile != null) { var appUser = userProfile.ApplicationUser; if (appUser != null) { if (!(appUser.EmailConfirmed)) { return(HttpNotFound("you are not confirmed email or phone number")); } } } else { return(View("_CreateOfferConfirmationError")); } if (userProfile.Offers.Count(o => o.State == OfferState.active) >= 10) { return(View("CrateOfferLimitError")); } Offer offer = Mapper.Map <CreateOfferViewModel, Offer>(model); Game game = _gameService.GetGameByValue(model.Game); var gameFilters = _filterService.GetFilters(f => f.Game.Value == game.Value, i => i.Game, i => i.FilterItems).ToList(); var modelFilters = model.FilterValues; //var gameFilterItems = _filterItemService.GetFilterItems().Where(f => f.Filter.Game == game).ToList(); var modelFilterItems = model.FilterItemValues; if (modelFilters != null && gameFilters.Count != 0) { if (game != null && modelFilters.Length == gameFilters.Count) { for (int i = 0; i < gameFilters.Count; i++) { if (gameFilters[i].Value != modelFilters[i]) { return(View("_CreateOfferFilterError")); } bool isContainsFilterItems = false; foreach (var fItem in gameFilters[i].FilterItems) { if (fItem.Value == modelFilterItems[i]) { offer.FilterItems.Add(fItem); offer.Filters.Add(gameFilters[i]); isContainsFilterItems = true; } } if (!isContainsFilterItems) { return(View("_CreateOfferFilterError")); } } } else { return(View("_CreateOfferFilterError")); } } foreach (var image in images) { if (image != null && image.ContentLength <= 1000000 && (image.ContentType == "image/jpeg" || image.ContentType == "image/png")) { var extName = System.IO.Path.GetExtension(image.FileName); var fileName = $@"{Guid.NewGuid()}{extName}"; // сохраняем файл в папку Files в проекте string fullPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "\\Content\\Images\\Avatars", fileName); var urlPath = Url.Content("~/Content/Images/Screenshots/" + fileName); image.SaveAs(fullPath); offer.ScreenshotPathes.Add(new ScreenshotPath { Value = urlPath }); } else { offer.ScreenshotPathes.Add(new ScreenshotPath { Value = null }); } } offer.GameId = game.Id; offer.UserProfileId = _userProfileService.GetUserProfileById(User.Identity.GetUserId()).Id; offer.DateDeleted = offer.DateCreated.AddDays(offerDays); _offerService.CreateOffer(offer); _offerService.SaveOffer(); if (Request.Url != null) { offer.JobId = MarketHangfire.SetDeactivateOfferJob(offer.Id, Url.Action("Activate", "Offer", new { id = offer.Id }, Request.Url.Scheme), TimeSpan.FromDays(30)); } _offerService.SaveOffer(); var offerModel = Mapper.Map <Offer, OfferViewModel>(offer); return(View("OfferCreated", offerModel)); }