Ejemplo n.º 1
0
        public async Task <ActionResult <Buisness> > PostBuisness(Buisness buisness)
        {
            _context.Buisness.Add(buisness);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetBuisness", new { id = buisness.Id }, buisness));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> PutBuisness(int id, Buisness buisness)
        {
            if (id != buisness.Id)
            {
                return(BadRequest());
            }

            _context.Entry(buisness).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BuisnessExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public void TestInitCatalogCoupon()
        {
            //making sure the table is empty
            TestBuisness.clearAllTable();

            uAdmin         = new Users_SystemAdministrator();
            user2          = new User();
            user2.userName = "******";
            uAdmin.User    = user2;
            cat1           = new CatalogCoupon();
            cat1.catalogID = 123;
            cat1.Users_SystemAdministrator = uAdmin;
            ca_da           = new CatalogCouponDataAccess();
            cat1.CouponName = "free resert";
            user1           = new User();
            c1                     = new Category();
            b1                     = new Buisness();
            l1                     = new Location();
            l1.latitude            = 34.8999;
            l1.longitude           = 45.3666;
            ub1                    = new Users_BuisnessOwner();
            b1.BuisDescription     = "Sushi bar";
            b1.buisAddress         = "Aharom Meskin 13";
            b1.buisCity            = "Beer-Sheva";
            b1.buisName            = "JAPANIKA";
            user1.userName         = "******";
            c1.catName             = "food";
            ub1.User               = user1;
            b1.Users_BuisnessOwner = ub1;
            b1.Category            = c1;
            b1.Location            = l1;
            cat1.Category          = c1;
            cat1.Location          = l1;
            cat1.Buisness          = b1;
        }
Ejemplo n.º 4
0
 public AccountController(Buisness.Services.IAuthenticationService service)
 {
     if(service==null)
     {
         throw new ArgumentNullException("Authentication Service");
     }
     _authService = service;
 }
Ejemplo n.º 5
0
        public void updateBuisnessDescription()
        {
            buisness_da.addBuisness(b1);
            Assert.IsTrue(buisness_da.existsBuisness(b1));
            string newDescription = "Shusi and gril";

            buisness_da.updateDescription(b1, newDescription);
            Buisness afterUpdate = buisness_da.findBuisness(b1);

            Assert.AreEqual(newDescription, afterUpdate.BuisDescription);
            TestBuisness.clearAllTable();
        }
Ejemplo n.º 6
0
        public void updateBuisnessAddress()
        {
            buisness_da.addBuisness(b1);
            Assert.IsTrue(buisness_da.existsBuisness(b1));
            string newAddress = "Ehad Haam 12";

            buisness_da.updateAddress(b1, newAddress);
            Buisness afterUpdate = buisness_da.findBuisness(b1);

            Assert.AreEqual(newAddress, afterUpdate.buisAddress);
            TestBuisness.clearAllTable();
        }
Ejemplo n.º 7
0
        public void updateBuisnessCity()
        {
            buisness_da.addBuisness(b1);
            Assert.IsTrue(buisness_da.existsBuisness(b1));
            string newCity = "Jerusalem";

            buisness_da.updateCity(b1, newCity);
            Buisness afterUpdate = buisness_da.findBuisness(b1);

            Assert.AreEqual(newCity, afterUpdate.buisCity);
            TestBuisness.clearAllTable();
        }
Ejemplo n.º 8
0
        public void updateBuisnessCategory()
        {
            buisness_da.addBuisness(b1);
            Assert.IsTrue(buisness_da.existsBuisness(b1));
            Category newCategory = new Category();

            newCategory.catName = "sport";
            buisness_da.updateCategory(b1, newCategory);
            Buisness afterUpdate = buisness_da.findBuisness(b1);

            Assert.AreEqual(newCategory.catName, afterUpdate.Category.catName);
            TestBuisness.clearAllTable();
        }
Ejemplo n.º 9
0
        public void updateBuisnessOwner()
        {
            buisness_da.addBuisness(b1);
            Assert.IsTrue(buisness_da.existsBuisness(b1));
            User u2 = new User();
            Users_BuisnessOwner owner = new Users_BuisnessOwner();

            u2.userName = "******";
            owner.User  = u2;
            buisness_da.updateOwner(b1, owner);
            Buisness afterUpdate = buisness_da.findBuisness(b1);

            Assert.AreEqual(owner.userName, afterUpdate.Users_BuisnessOwner.userName);
            TestBuisness.clearAllTable();
        }
Ejemplo n.º 10
0
        public void updateBuisnessLocation()
        {
            buisness_da.addBuisness(b1);
            Assert.IsTrue(buisness_da.existsBuisness(b1));
            Location newLoc = new Location();

            newLoc.latitude  = 34.5;
            newLoc.longitude = 31.8;
            buisness_da.updateLocation(b1, newLoc);
            Buisness afterUpdate = buisness_da.findBuisness(b1);

            Assert.AreEqual(newLoc.longitude, afterUpdate.Location.longitude);
            Assert.AreEqual(newLoc.latitude, afterUpdate.Location.latitude);
            TestBuisness.clearAllTable();
        }
Ejemplo n.º 11
0
        public void TestInitBuisness()
        {
            //making sure the table is empty
            TestBuisness.clearAllTable();

            user1                  = new User();
            c1                     = new Category();
            b1                     = new Buisness();
            l                      = new Location();
            l.latitude             = 34.8999;
            l.longitude            = 45.3666;
            ub                     = new Users_BuisnessOwner();
            b1.BuisDescription     = "Sushi bar";
            b1.buisAddress         = "Aharom Meskin 13";
            b1.buisCity            = "Beer-Sheva";
            b1.buisName            = "JAPANIKA";
            user1.userName         = "******";
            c1.catName             = "food";
            ub.User                = user1;
            b1.Users_BuisnessOwner = ub;
            b1.Category            = c1;
            b1.Location            = l;
            buisness_da            = new BuisnessDataAccess();
        }
Ejemplo n.º 12
0
 public void Delete(Buisness item)
 {
     Delete(DbContext.Buisnesses, item);
 }
Ejemplo n.º 13
0
 public void Add(Buisness item)
 {
     Add(DbContext.Memos, item);
 }
 public BuisnessListViewModel(Buisness buisness)
 {
     this.Id          = buisness.Id;
     this.Name        = buisness.Name;
     this.Description = buisness.Description;
 }
Ejemplo n.º 15
0
 void Start()
 {
     buisness = GetComponent <Buisness>();
 }
Ejemplo n.º 16
0
 public static int Compare(Buisness e1, Buisness e2)
 {
     return(e1.StartTime <= e2.EndTime && e1.EndTime >= e2.StartTime ? 0
         : e1.EndTime < e2.StartTime ? 1
         : -1);
 }
Ejemplo n.º 17
0
        public ActionResult Add(Memo m)
        {
            switch (m.Type)
            {
            case "Памятка":
                if (TryValidateModel(m))
                {
                    u.Add(m);
                    u.SaveChanges();
                    return(JavaScript("location.reload(true)"));
                }
                else
                {
                    return(PartialView("AddMemo", m));
                }

            case "Дело":
                var tmp = m as Buisness;
                if (TryValidateModel(tmp))
                {
                    if (u.Get <Buisness>(x => Buisness.Compare(x, tmp) == 0) == null)
                    {
                        u.Add(m);
                        u.SaveChanges();
                        return(JavaScript("location.reload(true)"));
                    }
                    else
                    {
                        ModelState.AddModelError("intersect", "Эта запись пересекается с другой по времени!");
                        return(PartialView("AddBuisness", tmp));
                    }
                }
                else
                {
                    return(PartialView("AddBuisness", tmp));
                }

            case "Встреча":
                var tmp1 = m as Meeting;
                if (TryValidateModel(m as Meeting))
                {
                    if (u.Get <Buisness>(x => Buisness.Compare(x, tmp1) == 0) == null)
                    {
                        u.Add(m);
                        u.SaveChanges();
                        return(JavaScript("location.reload(true)"));
                    }
                    else
                    {
                        ModelState.AddModelError("intersect", "Эта запись пересекается с другой по времени!");
                        return(PartialView("AddMeeting", tmp1));
                    }
                }
                else
                {
                    return(PartialView("AddMeeting", tmp1));
                }

            default: return(RedirectToAction("Index"));
            }
        }