public ActionResult call(decimal seconds) { int userId = ((UserDTO)Session["user"]).Id; VO.Entities.Consumes recharge = new VO.Entities.Consumes() { }; return(Json(Factory.Consumes.Call(userId, seconds))); }
public VO.Entities.Consumes Call(int userId, decimal seconds) { VO.Entities.Settings valueSecond = DAO.Resolve <SettingsDAO>().GetByKey("SecondValue"); decimal valueCall = (seconds * decimal.Parse(valueSecond.Value)); VO.Entities.Consumes newConsume = new VO.Entities.Consumes() { UserId = userId, DateCall = DateTime.Now, Time = seconds, ValueCall = valueCall }; DAO.Resolve <ConsumesDAO>().Create(newConsume); VO.Entities.ClientUser user = DAO.Resolve <ClientsDAO>().Get(userId); user.Balance = user.Balance - valueCall; user.Balance = user.Balance < 0 ? 0 : user.Balance; return(newConsume); }
public VO.Entities.Consumes Delete(int id) { VO.Entities.Consumes data = DAO.Resolve <ConsumesDAO>().Get(id); DAO.Resolve <ConsumesDAO>().Delete(data); return(data); }
public VO.Entities.Consumes Update(VO.Entities.Consumes entity) { VO.Entities.Consumes data = null; data = DAO.Resolve <ConsumesDAO>().Update(entity); return(data); }