public async Task <IHttpActionResult> PutOffert(int id, Offert offert) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != offert.OffertId) { return(BadRequest()); } db.Entry(offert).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OffertExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <Publications> OfferPublication(Offert offert, string token = "") { try { return(await this._consumer.OfferPublication(offert, token)); }catch (Exception) { return(new Publications()); } }
public async Task <IActionResult> Update(Offert model) { if (ModelState.IsValid) { await _offertService.Update(model); TempData["Offert"] = "Actualizada Correctamente"; return(RedirectToAction("Offerts", "Admin")); } return(View(model)); }
public async Task <IHttpActionResult> PostOffert(Offert offert) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Offerts.Add(offert); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = offert.OffertId }, offert)); }
public async Task <IHttpActionResult> DeleteOffert(int id) { Offert offert = await db.Offerts.FindAsync(id); if (offert == null) { return(NotFound()); } db.Offerts.Remove(offert); await db.SaveChangesAsync(); return(Ok(offert)); }
public async Task <IActionResult> Add(Offert model) { if (ModelState.IsValid) { if (await _offertService.Add(model)) { TempData["Offert"] = "Agregado Correctamente"; return(RedirectToAction("Offerts", "Admin")); } TempData["Offert"] = "No se pudo agregar"; return(View(model)); } else { return(View(model)); } }
public static Offert MapOffertResourceToOffert(OffertResource offertResource) { var offert = new Offert { Name = offertResource.Name, Description = offertResource.Description, MaxPrice = offertResource.MaxPrice, MinPrice = offertResource.MinPrice, DateEnd = offertResource.DateEnd, DateStart = offertResource.DateStart, IsPublished = offertResource.IsPublished, ActualPlaces = offertResource.ActualPlaces, Places = offertResource.MaxPlaces, OffertType = offertResource.OffertType, AccomodationId = offertResource.AccomodationId, CityId = offertResource.CityId, OffertAttractions = MapAttractionDatesResourcesToOffertAttractions(offertResource.AttractionsDates) }; return(offert); }
public static OffertResource MapOffertToOffertResource(Offert offert) { var offertResource = new OffertResource { Id = offert.Id, Name = offert.Name, Description = offert.Description, MaxPrice = offert.MaxPrice, MinPrice = offert.MinPrice, DateEnd = offert.DateEnd, DateStart = offert.DateStart, MaxPlaces = offert.Places, OffertType = offert.OffertType, IsPublished = offert.IsPublished, ActualPlaces = offert.ActualPlaces, AccomodationId = offert.AccomodationId, CityId = offert.CityId, AttractionsDates = MapOffertAttractionsToAttractionDatesResources(offert.OffertAttractions) }; return(offertResource); }
public async Task <Task> Publicar([FromBody] Offert oferta) { Publications resultado = new Publications() { Error = new Exception("Invalid offert") }; resultado = await this._aS.OfferPublication(oferta, oferta.Token); if (resultado.Errors != null) { return(Clients.Caller.SendAsync("Publications", resultado)); } if (resultado.Error != null) { return(Clients.Caller.SendAsync("Publications", resultado)); } resultado.Bids = new List <Bids>() { new Bids() { Factor = new People() { Id = oferta.Factor_id } } }; if (oferta.Factor_id == resultado.Bids[0].Factor_id) { resultado.isOffered = true; } return(Clients.Group(resultado.Invoice.Country.Value + "").SendAsync("Publications", resultado)); }
public async Task <JsonResult> OnPostOfertar([FromBody] Offert oferta) { var token = HttpContext.Session.GetString("token"); Publications data = new Publications(); oferta.Factor_id = this._signInManager.UserManager.GetUserId(User); data = await this._aS.OfferPublication(oferta, token); if (data.Error == null) { var id = User.Claims.Where(x => x.Type == "Id").Select(x => x.Value).SingleOrDefault(); var l = await this._authS.RefreshToken(id, CultureInfo.CurrentCulture.Name, "FACTOR", token); if (l.Error == null) { HttpContext.Session.SetString("token", l.Token); } } return(new JsonResult(data)); }
public async Task <bool> CreateOffert(string title, int type, string review, string features, bool contract, string userId, string tel, decimal price, string town) { var artistId = await this.userService.GetArtistId(userId); var offer = new Offert() { Title = title, Type = (OrderType)type, Review = review, Features = features, Contract = contract, ArtistId = artistId, Tel = tel, Price = price, Town = town, }; await this.repository.AddAsync(offer); var result = await this.repository.SaveChangesAsync(); return(result > 0); }
public AirProvider(WebClient client, RyanairOffert offert) { _webClient = client; _airOffert = offert; }
public void UpdateOffert(Offert offert) { throw new NotImplementedException(); }
public void AddOffert(Offert offert) { _serviceDbContext.Offerts.Add(offert); }