Exemple #1
0
        public async Task <IActionResult> Get(string key)
        {
            var     repository = new ShipperRepository(_context);
            Shipper shipper    = await repository.GetById(key);

            return(Ok(shipper));
        }
        public bool Approve(int id)
        {
            var shipper = _repo.GetById(id).Translate <ShipperDetail, ShipperDetailDTO>();

            shipper.StatusId = ACTIVE;
            var mess = new Message();

            mess.DataID      = null;
            mess.Description = "You have been processed to be a shipper.";
            mess.FromID      = 1;
            mess.IsRead      = false;
            mess.MessageType = null;
            mess.SentID      = shipper.ShipperId;
            mess.CreatedDate = DateTime.Now;
            _mess.CreateMessage(mess);
            return(_repo.Update(shipper.Translate <ShipperDetailDTO, ShipperDetail>()));
        }
        public ActionResult Shipper(Int32 id)
        {
            Shipper shipper;

            using (MySqlConnection conn = DBUtils.GetConnection())
            {
                ShipperRepository repo = new ShipperRepository(conn);
                shipper = repo.GetById(id.ToString());
            }

            return(View(shipper));
        }
Exemple #4
0
        public ActionResult RemoveShipper(Administrators admin)
        {
            Shipper shipper = null;

            using (MySqlConnection conn = DBUtils.GetConnection())
            {
                ShipperRepository repo = new ShipperRepository(conn);
                shipper = repo.GetById(admin.ShipperID.ToString());
                if (shipper != null)
                {
                    repo.Delete(shipper.ShipperID.ToString());
                }
            }
            return(View("Administrator"));
        }