Ejemplo n.º 1
0
 public ActionResult Create([Bind(Include = "FilialKeyGUID,Vereinsname,Strasse,Ort,PLZ,FK_Verband")] Filiale filiale)
 {
     if (ModelState.IsValid)
     {
         filiale.FilialKeyGUID = Guid.NewGuid();
         m_branchRepository.Create(filiale);
         return(RedirectToAction("Index"));
     }
     ViewBag.FK_Verband = new SelectList(m_federations, "VerbandKeyGUID", "Name", filiale.FK_Verband);
     return(View(filiale));
 }
Ejemplo n.º 2
0
        public Branch Create(long userId, Branch toAdd)
        {
            using (var tran = new TransactionScope())
            {
                var toRet = _repository.Create(toAdd);

                BlLog.Log(userId, Module, "Delete branch", "BranchCreated", new object[] { toAdd.Id });
                tran.Complete();
                return(toRet);
            }
        }
 public ActionResult Create(Branch b)
 {
     try
     {
         Branch branch = _branchRepository.Create(b);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Ejemplo n.º 4
0
        public string Edit(FormDataCollection form)
        {
            var retVal    = string.Empty;
            var operation = form.Get("oper");
            var id        = ConvertHelper.ToInt32(form.Get("BranchId"));

            if (!string.IsNullOrEmpty(operation))
            {
                BranchInfo info;
                switch (operation)
                {
                case "edit":
                    info = BranchRepository.GetInfo(id);
                    if (info != null)
                    {
                        info.Code        = form.Get("Code");
                        info.Name        = form.Get("Name");
                        info.LocationID  = ConvertHelper.ToInt32(form.Get("LocationName"));
                        info.Description = form.Get("Description");
                        //info.Status = form.Get("Status");
                        info.ChangedBy = UserRepository.GetCurrentUserInfo().UserID;
                        BranchRepository.Update(info);
                    }
                    break;

                case "add":
                    info = new BranchInfo
                    {
                        Code        = form.Get("Code"),
                        Name        = form.Get("Name"),
                        LocationID  = ConvertHelper.ToInt32(form.Get("LocationName")),
                        Description = form.Get("Description"),
                        //Status = form.Get("Status"),
                        CreatedBy = UserRepository.GetCurrentUserInfo().UserID
                    };

                    BranchRepository.Create(info);
                    break;

                case "del":
                    BranchRepository.Delete(id, UserRepository.GetCurrentUserInfo().UserID);
                    break;
                }
            }
            //StoreData.ListBranch = BranchRepository.GetAll();
            return(retVal);
        }
Ejemplo n.º 5
0
 public async Task Create_BranchNameIsNull_ThrowsArgumentNullException()
 {
     await Assert.ThrowsAsync <ArgumentNullException>(() => _sut.Create(0, null, "refName"));
 }