Ejemplo n.º 1
0
        public ActionResult Create(OfferDto offerDto)
        {
            bool isOk = TryUpdateModel(offerDto);

            if (isOk && ModelState.IsValid)
            {
                _offerService.AddOffer(offerDto);

                return(RedirectToAction("Index"));
            }

            return(View(offerDto));
        }
Ejemplo n.º 2
0
        public async Task Test_AddOffer_ShouldAddOffer()
        {
            var offer = new OfferDTO
            {
                TutorId = "100",
                Title   = "NewlyAdded"
            };

            var context = await GetContext();

            var offerRepo    = new DbRepository <Offer>(context);
            var offerService = new OfferService(offerRepo);
            int result       = await offerService.AddOffer(offer);

            Assert.Equal(5, context.Offers.CountAsync().Result);
            Assert.Contains("NewlyAdded", context.Offers.Select(p => p.Title).ToArray());
        }
Ejemplo n.º 3
0
 public async void AddNewOffer(string title, string description, string location, string contactperson, DateTime start, DateTime end, string userId, int offercategory)
 {
     Offer ofr = new Offer
     {
         Title           = title,
         Description     = description,
         Location        = location,
         ContactPerson   = contactperson,
         StartTime       = start,
         EndTime         = end,
         OfferCreated    = DateTime.Now,
         OfferExpires    = DateTime.Now.AddDays(30),
         OfferCategoryId = offercategory + 1,
         UserId          = "fd2d7f99-d5a7-4a6c-a41f-2f0d0a153690"
     };
     await _service.AddOffer(ofr);
 }
Ejemplo n.º 4
0
        static void addOffer()
        {
            Paymill.ApiKey = Properties.Settings.Default.ApiKey;
            Paymill.ApiUrl = Properties.Settings.Default.ApiUrl;
            OfferService offerService = Paymill.GetService <OfferService>();

            Offer offer = new Offer();

            offer.Amount            = 1500;
            offer.Currency          = "eur";
            offer.Interval          = Offer.TypeInterval.MONTH;
            offer.Name              = "Prueba API";
            offer.Trial_Period_Days = 3;

            Offer newOffer = offerService.AddOffer(offer);

            Console.WriteLine("OfferID:" + newOffer.Id);
            Console.Read();
        }
Ejemplo n.º 5
0
 public IActionResult Post(AddOfferModel offerModels)
 {
     return(Ok(offerService.AddOffer(offerModels)));
 }