public dynamic PutBranch(BranchesVM b)
        {
            var branch = db.Branches.Find(b.Id);

            branch.Company_ID         = b.CompanyId;
            branch.Branch_A_Title     = b.BranchName_A;
            branch.Branch_E_Name      = b.BranchNameE;
            branch.Branch_Location    = b.BranchLocation;
            branch.Branch_Image       = b.BranchImage;
            branch.Branch_Description = b.BranchDescription;
            branch.Manager_ID         = b.ManagerId;
            branch.User_ID            = b.UserId;
            branch.Last_Update        = DateTime.Now;


            var result = db.SaveChanges() > 0 ? true : false;

            return(new
            {
                result = result
            });
        }
        public dynamic PostBranch(BranchesVM b)
        {
            var branch = db.Branches.Add(new Branch
            {
                Company_ID         = b.CompanyId,
                Branch_A_Title     = b.BranchName_A,
                Branch_E_Name      = b.BranchNameE,
                Branch_Location    = b.BranchLocation,
                Branch_Image       = b.BranchImage,
                Branch_Description = b.BranchDescription,
                Manager_ID         = b.ManagerId,
                User_ID            = 124,
                Last_Update        = DateTime.Now,
                RegionId           = 1,
                CityId             = 1
            });
            var result = db.SaveChanges() > 0 ? true : false;

            return(new
            {
                result = result,
                branchId = branch.Branch_ID
            });
        }
Beispiel #3
0
        public JsonResult Save(BranchesVM branchesVM)
        {
            var msgModel = BranchesManager.Instance.PostBranch(branchesVM);

            return(Json(msgModel, JsonRequestBehavior.AllowGet));
        }