Пример #1
0
        protected override void Seed(SharedDatabaseManagement.DataModel.DolphinContext context)
        {
            var client = new Client()
            {
                Id      = 1,
                Name    = "Doctor Strange",
                Address = "New York",
                Mobile  = "99999999999",
                Email   = "*****@*****.**",
            };

            var toner = new Toner()
            {
                Id     = 1,
                Name   = "Epson L800",
                Client = client,
            };

            var employee = new Employee()
            {
                Id      = 1,
                Name    = "SpiderMan",
                Address = "New York",
                Mobile  = "99999999999",
                Email   = "*****@*****.**",
            };

            //context.Clients.AddOrUpdate(client);
            //context.Toners.AddOrUpdate(toner);
            //context.Employees.AddOrUpdate(employee);
        }
Пример #2
0
        // POST: api/Toner
        public TonerViewModel Post([FromBody] TonerViewModel value)
        {
            var toner = Toner.Create(value.Name, value.ClientId);

            repository.Insert(toner);
            return(Mapper.Map <TonerViewModel>(toner));
        }
Пример #3
0
        public bool isValid(Toner entity)
        {
            var validator = new TonerValidator();
            var result    = validator.Validate(entity);

            return(result.IsValid);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Toner toner = db.Toners.Find(id);

            db.Toners.Remove(toner);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        //
        // GET: /Toner/Delete/5

        public ActionResult Delete(int id = 0)
        {
            Toner toner = db.Toners.Find(id);

            if (toner == null)
            {
                return(HttpNotFound());
            }
            return(View(toner));
        }
 public ActionResult Edit(Toner toner)
 {
     if (ModelState.IsValid)
     {
         db.Entry(toner).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(toner));
 }
Пример #7
0
 public ActionResult Edit([Bind(Include = "TonerID,TonerModel,TonerIsOriginal,TonerYield,TonerGram,TonerProductNo,TonerMinQuantity,Created")] Toner toner)
 {
     if (ModelState.IsValid)
     {
         db.Entry(toner).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(toner));
 }
Пример #8
0
    public void Start(IModLoaderV1 loader)
    {
        _modLoader = (IModLoader)loader;

        /* Your mod code starts here. */
        _modLoader.GetController <IReloadedHooks>().TryGetTarget(out _hooks);
        _modLoader.GetController <IPrsInstance>().TryGetTarget(out var _prsInstance);
        SDK.Init(_hooks, _prsInstance);
        _toner = new Toner();
    }
        public ActionResult Create(Toner toner)
        {
            if (ModelState.IsValid)
            {
                db.Toners.Add(toner);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(toner));
        }
Пример #10
0
        public ActionResult Create([Bind(Include = "TonerID,TonerModel,TonerIsOriginal,TonerYield,TonerProductNo,TonerGram,Created")] Toner toner)
        {
            if (ModelState.IsValid)
            {
                db.Toners.Add(toner);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(toner));
        }
Пример #11
0
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Toner toner = db.Toners.Find(id);

            if (toner == null)
            {
                return(HttpNotFound());
            }
            return(View(toner));
        }
Пример #12
0
        public IList <ErrorMessage> Errors(Toner entity)
        {
            var validator = new TonerValidator();
            var result    = validator.Validate(entity);
            var errors    = new List <ErrorMessage>();

            foreach (var item in result.Errors)
            {
                errors.Add(new ErrorMessage {
                    Key = item.PropertyName, Error = item.ErrorMessage
                });
            }

            return(errors);
        }
Пример #13
0
 public void Remove(Toner entity)
 {
     _repository.Remove(entity);
 }
Пример #14
0
 public void Update(Toner entity)
 {
     _repository.Update(entity);
 }
Пример #15
0
 public Toner Find(Toner entity)
 {
     return(_repository.Find(entity));
 }
Пример #16
0
 public void Add(Toner entity)
 {
     _repository.Add(entity);
 }