public Offer Update(Offer Offer) { OfferRepository <Offer> Offerrepo = new OfferRepository <Offer>(); Offer.DateOffer = DateTime.Now; int? rta = Offerrepo.Update(Offer); Log4NetLogger logger2 = new Log4NetLogger(); SUser suser = new SUser(); var user = suser.GetUserById(new Guid(Offer.IdUser)); SCategory scate = new SCategory(); var cate = scate.FindCategoryById(Offer.CategoryId); logger2.Info("Actualización Oferta:" + Offer.TitleOffer + "," + "UsuarioOrigen:" + user.UserName + ",Categoria:" + cate.Name); if (rta == null) { return(null); } else { return(Offer); } }
public int?ChangeStatusPhases(ICollection <OfferPhases> offerPhases, Persistence.Entities.StatusPhase status, Persistence.Entities.Offer offer) { int?rta = null; OfferUserRepository <OfferUser> OfferUrepo = new OfferUserRepository <OfferUser>(); OfferRepository <Offer> Offerrepo = new OfferRepository <Offer>(); //if (status == StatusPhase.Aplicada) //if (!OfferUrepo.HaveOfferUsers(offerPhases.FirstOrDefault().IdOffer) && status==StatusPhase.Aplicada ) //{ OfferPhasesRepository <OfferPhases> OfferPrepo = new OfferPhasesRepository <OfferPhases>(); offer.Status = Offer.StatusOffer.Eliminada; Offerrepo.Update(offer); foreach (var offerphase in offerPhases) { offerphase.StatusPhase = status; rta = OfferPrepo.Update(offerphase); if (status == StatusPhase.Finalizada) { Business.Log4NetLogger logger2 = new Business.Log4NetLogger(); logger2.Info("Proyecto finalizado:" + offerphase.IdOffer); } else if (status == StatusPhase.Eliminada) { Business.Log4NetLogger logger2 = new Business.Log4NetLogger(); logger2.Info("Proyecto eliminado:" + offerphase.IdOffer); } if (rta == null) { break; } } //} return(rta); }
public IHttpActionResult Put([FromUri] int id, [FromBody] Offer offer) { offer.OfferId = id; offerRepository.Update(offer); return(Ok(offer)); }