Exemplo n.º 1
0
 public JsonResult Update(LotModel lotModel)
 {
     var lot = MyLotsRepository.GetById(HttpContext.User.Identity.Name, lotModel.Id);
     lot.Name = lotModel.Name;
     lot.Description = lotModel.Description;
     lot.Price = lotModel.Price;
     MyLotsRepository.Update(lot);
     return JsonSuccess(new
     {
         Lots = new[] { LotModel.FromLot(lot) }
     });
 }
Exemplo n.º 2
0
 public static LotModel FromLot(Lot lot)
 {
     var lotModel = new LotModel
     {
         Id = lot.Id,
         Name = lot.Name,
         Description = lot.Description,
         DateTime = lot.DateTime,
         Hidden = lot.Hidden,
         Price = lot.Price,
         User = lot.User.Name
     };
     return lotModel;
 }
Exemplo n.º 3
0
 public JsonResult Add(LotModel lotModel)
 {
     var lot = new Lot
     {
         Name = lotModel.Name,
         Description = lotModel.Description,
         Price = lotModel.Price
     };
     MyLotsRepository.Save(HttpContext.User.Identity.Name, lot);
     return JsonSuccess(new
     {
         Lots = new [] { LotModel.FromLot(lot) }
     });
 }
Exemplo n.º 4
0
 public JsonResult Remove(LotModel lotModel)
 {
     var lot = MyLotsRepository.GetById(HttpContext.User.Identity.Name, lotModel.Id);
     MyLotsRepository.Remove(lot);
     return JsonSuccess();
 }