public ActionResult MarketJobEdit(int?id)
        {
            if (!caSession.AuthoriseSession())
            {
                return(Redirect((string)Session["ErrorUrl"]));
            }
            var model = new MarketJobViewModel();

            if (id.HasValue && id > 0)
            {
                model = _marketServices.GetMarketJobById(id.Value);
            }
            model.AllCustomerAccounts = AccountServices.GetAllValidAccounts(CurrentTenantId, EnumAccountType.Customer).Select(m => new SelectListItem()
            {
                Text = m.CompanyName, Value = m.AccountID.ToString()
            }).ToList();
            model.AllResources = _employeeServices.GetAllEmployees(CurrentTenantId).Select(m => new SelectListItem()
            {
                Text = m.Name, Value = m.ResourceId.ToString()
            }).ToList();
            model.AllResources.Insert(0, new SelectListItem()
            {
                Text = "Un-Allocated", Value = "0"
            });
            return(View("~/Views/MarketJob/_CreateEdit.cshtml", model));
        }
Example #2
0
        public async Task <IHttpActionResult> AcceptMarketJobRequest(MarketJobSync request)
        {
            request.SerialNumber = request.SerialNumber.Trim().ToLower();

            var terminal = TerminalServices.GetTerminalBySerial(request.SerialNumber);

            if (terminal == null)
            {
                return(Unauthorized());
            }

            var TransactionLog = TerminalServices.CheckTransactionLog(request.TransactionLogId, terminal.TerminalId);

            if (TransactionLog == true)
            {
                return(Conflict());
            }

            var marketJob = _marketServices.GetMarketJobById(request.MarketJobId);

            if (marketJob.Id == 0)
            {
                return(NotFound());
            }

            var result = await _marketServices.AcceptMarketJob(request.MarketJobId, request.UserId, terminal.TenantId, terminal.TermainlSerial, request.Latitude, request.Longitude);

            return(Ok(result));
        }