Ejemplo n.º 1
0
        /* Anasayfa Yazilimci Teklif Yapma Islemi */
        public IActionResult TeklifYap(int Id, AnasayfaIslerViewModel anasayfaIslerViewModel)
        {
            int developerId;

            if (HttpContext.Session.GetString("SessionDeveloperId") != null)
            {
                developerId = Convert.ToInt32(HttpContext.Session.GetString("SessionDeveloperId"));
                bool flag = true;
                foreach (var item in _offerService.GetOffersByJobId(Id))
                {
                    if (item.DeveloperId == developerId)
                    {
                        flag = false;
                    }
                }
                if (flag == true)
                {
                    Offer offer = anasayfaIslerViewModel.Offer;
                    offer.CreatedDate        = DateTime.Now;
                    offer.JobId              = Id;
                    offer.DeveloperId        = developerId;
                    TempData["OfferMessage"] = "Başarılı Bir Şekilde Teklif Verdiniz.";
                    _offerService.Add(offer);
                }
                else
                {
                }
            }
            return(RedirectToAction("IsDetay", new { Id = Id }));
        }
Ejemplo n.º 2
0
        public ActionResult Add(OfferOfferDetailVM offerOfferDetailVM, Guid id)
        {
            var result = _os.Add(offerOfferDetailVM.Offer, offerOfferDetailVM.OfferDetails, id);

            ViewBag.Sonuc      = result.Message;
            ViewBag.SonucState = result.State;
            return(View(offerOfferDetailVM));
        }
Ejemplo n.º 3
0
        internal void AddOffer(string vehicleID, string driverID, int source, int destinaiton, List <int> viaPoints, byte seats, DateTime startDate, DateTime endDate)
        {
            Offer Offer = SetOffer(vehicleID, driverID, source, destinaiton, viaPoints, seats, startDate, endDate);

            Offer = OfferServices.Create(Offer);
            OfferServices.Add(Offer);
            OfferServices.SaveData();
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> AddOffer()
        {
            _offerService.Add(new Offer()
            {
                Name = "Awesome offer"
            });

            return(Ok());
        }
Ejemplo n.º 5
0
        public IActionResult Create([FromBody] Offer Model)
        {
            var offer = _repos.Add(Model);

            if (offer == null)
            {
                return(BadRequest(new { message = "Error Occured" }));
            }
            return(Ok(new { message = offer.ID }));
        }
Ejemplo n.º 6
0
        public ActionResult CreateOffer([FromBody] CreateOfferViewModel model)
        {
            if (ModelState.IsValid)
            {
                string companyId = User.Claims.Where(x => x.Type == "UserId").FirstOrDefault().Value;
                _offerService.Add(model, companyId);
                return(Ok("Job offer is successfully created."));
            }

            return(BadRequest(model));
        }
Ejemplo n.º 7
0
        // To protect from overposting attacks, see https://aka.ms/RazorPagesCRUD
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var result = await _offerService.Add(Offer);

            if (result.HasError)
            {
                Errors = string.Join(" /n ", result.ErrorMessages);
                return(Page());
            }

            return(RedirectToPage("./Index", new { vendorId = Offer.VendorId }));
        }
Ejemplo n.º 8
0
        public ActionResult Create(OfferVm ovm, HttpPostedFileBase file)
        {
            if (
                file == null ||
                file.ContentLength == 0)
            {
                return(RedirectToAction("Create"));
            }


            Offer offerdomain = new Offer()
            {
                StartDate   = ovm.StartDate,
                OfferName   = ovm.OfferName,
                Price       = ovm.Price,
                EndDate     = ovm.EndDate,
                ProductId   = ovm.ProductId,
                Description = ovm.Description,
                ImgUrl      = file.FileName,
            };

            service.Add(offerdomain);
            service.Commit();


            var path = "";
            //ajout d'image sous dossier
            var fileName = "";

            if (file.ContentLength > 0)
            {
                fileName = Path.GetFileName(file.FileName);
                path     = Path.
                           Combine(Server.MapPath("~/Content/Uploads/"),
                                   fileName);
                file.SaveAs(path);
            }
            var path2 = path;

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 9
0
        private void AddNewOffer()
        {
            Offer offer = new Offer(txtOfferId.Text.ToString());

            offer.OfferName          = txtOfferName.Text;
            offer.Description        = txtOfferDescription.Text;
            offer.DiscountPercentage = Convert.ToDouble(txtDiscount.Text);
            offer.OfferGiven         = Convert.ToDateTime(monthCalendarOfferGiven.SelectionRange.Start.ToShortDateString());
            offer.OfferValid         = Convert.ToDateTime(monthCalendarOfferExpired.SelectionRange.Start.ToShortDateString());
            offer.ItemCode           = txtItemCode.Text;
            offer.CategoryID         = txtCategoryID.Text;
            offer.MemberTypeID       = txtMemberTypeID.Text;

            ServiceFactory factory      = new ServiceFactory();
            IOfferService  offerService = factory.GetOfferServiceInstance();

            if (offerService.Add(offer) == 1)
            {
                this.refreshDelegate.Invoke();
                MessageBox.Show("Record Added Successfully!");
                this.Close();
            }
        }
Ejemplo n.º 10
0
        public async Task <IActionResult> Create(Offer viewModel)
        {
            if (User.IsInRole(Roles.Client) || !User.Identity.IsAuthenticated)
            {
                return(NotFound());
            }
            if (ModelState.IsValid)
            {
                var Id = await _offerService.Add(viewModel);

                if (!String.IsNullOrEmpty(Request.Form["continue"]))
                {
                    return(RedirectToAction("Edit", new { Id = Id }));
                }
                if (!String.IsNullOrEmpty(Request.Form["new"]))
                {
                    return(RedirectToAction(nameof(Create)));
                }
                return(RedirectToAction(nameof(Index)));
            }

            return(View(viewModel));
        }
Ejemplo n.º 11
0
        public ActionResult Create(OfferVM ovm)
        {
            Offer newoffer = new Offer()
            {
                OfferId                  = ovm.OfferId,
                Offer_Title              = ovm.Offer_Title,
                Offer_description        = ovm.Offer_description,
                Offre_Duration           = ovm.Offre_Duration,
                Offre_Salary             = ovm.Offre_Salary,
                Offer_Contract_Type      = (ContractType)ovm.Offer_Contract_Type,
                Offer_Level_Of_Expertise = (OfferLevel)ovm.Offer_Level_Of_Expertise,
                Offer_DatePublished      = DateTime.Now,
                Vues      = 0,
                CompanyId = ovm.CompanyId
            };

            OService.Add(newoffer);
            OService.Commit();



            return(RedirectToAction("Index"));
        }
        public async Task <IActionResult> Create([Bind("Id,VideoFile,VideoURL,Description,Photo1,Photo2,Photo3,Photo4,Photo5,SlotCode,GameId")] OfferViewModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    _offerService.BeginTransaction();
                    var offer = _offerService.Get(x => x.GameId == model.GameId);
                    if (offer != null)
                    {
                        offer.Description = model.Description;
                        offer.SlotCode    = model.SlotCode;
                        offer.VideoURL    = model.VideoURL;
                        if (model.Photo1 != null)
                        {
                            offer.Photo1 = helper.GetFileName(model.Photo1);
                            await helper.FileUploadAsync(model.Photo1, offer.Photo1, "Offer");
                        }
                        if (model.Photo2 != null)
                        {
                            offer.Photo2 = helper.GetFileName(model.Photo2);
                            await helper.FileUploadAsync(model.Photo2, offer.Photo2, "Offer");
                        }
                        if (model.Photo3 != null)
                        {
                            offer.Photo3 = helper.GetFileName(model.Photo3);
                            await helper.FileUploadAsync(model.Photo3, offer.Photo3, "Offer");
                        }
                        if (model.Photo4 != null)
                        {
                            offer.Photo4 = helper.GetFileName(model.Photo4);
                            await helper.FileUploadAsync(model.Photo4, offer.Photo4, "Offer");
                        }
                        if (model.Photo5 != null)
                        {
                            offer.Photo5 = helper.GetFileName(model.Photo5);
                            await helper.FileUploadAsync(model.Photo5, offer.Photo5, "Offer");
                        }
                        if (model.VideoFile != null)
                        {
                            offer.VideoName = helper.GetFileName(model.VideoFile);
                            await helper.FileUploadAsync(model.VideoFile, offer.VideoName, "Offer");
                        }
                        _offerService.Update(offer);
                    }
                    else
                    {
                        var newOffer = helper.GetOffer(model);
                        newOffer.Id = _offerService.Add(newOffer);
                        await helper.FileUploadAsync(model.Photo1, newOffer.Photo1, "Offer");

                        await helper.FileUploadAsync(model.Photo2, newOffer.Photo2, "Offer");

                        await helper.FileUploadAsync(model.Photo3, newOffer.Photo3, "Offer");

                        await helper.FileUploadAsync(model.Photo4, newOffer.Photo4, "Offer");

                        await helper.FileUploadAsync(model.Photo5, newOffer.Photo5, "Offer");

                        await helper.FileUploadAsync(model.VideoFile, newOffer.VideoName, "Offer");
                    }
                    _offerService.CommitTransaction();
                    return(RedirectToAction(nameof(Index), new { GameId = model.GameId }));
                }
                catch (Exception ex)
                {
                    _offerService.RollbackTransaction();
                }
            }
            return(View(model));
        }
Ejemplo n.º 13
0
 public IActionResult Post(OffersDto offer)
 {
     return(Ok(offerService.Add(offer)));
 }
        public async Task <IActionResult> Add([FromBody] OfferViewModel viewModel)
        {
            var id = await _service.Add(viewModel);

            return(Ok(id));
        }
Ejemplo n.º 15
0
 public async Task <IActionResult> Post(int id)
 {
     return(Json(await _offerService.Add(id)));
 }
Ejemplo n.º 16
0
 public async Task <ActionResult <OfferResponceModel> > Add(OfferAddRequestModel model) =>
 await offerService.Add(model.Price, model.CreatorId, model.ListingId, model.Title, model.CreatorName);