コード例 #1
0
        public override bool Delete <T>(T toDelete)
        {
            bool result = SourceRepository.Delete(toDelete);

            DeleteFromWriteRepos <T>(toDelete);
            return(result);
        }
コード例 #2
0
 // удаляет источник
 private void DeleteSource()
 {
     if (SelectedSource == null)
     {
         return;
     }
     Messager.ShowAskToDeleteMessage(SelectedSource.Name, delegate()
     {
         SourceRepository.Delete(SelectedSource);
         ChangeSourceList(SelectedSource.Type);
     });
 }
コード例 #3
0
ファイル: SourceController.cs プロジェクト: HungNV88/CRM
        public string Edit(FormDataCollection form)
        {
            string     retVal    = string.Empty;
            string     operation = form.Get("oper");
            int        id        = ConvertHelper.ToInt32(form.Get("SourceId"));
            SourceInfo info      = null;

            if (!string.IsNullOrEmpty(operation))
            {
                switch (operation)
                {
                case "edit":
                    info = SourceRepository.GetInfo(id);
                    if (info != null)
                    {
                        info.Name = form.Get("Name");

                        info.Code = form.Get("Code");

                        info.Description = form.Get("Description");


                        info.ChangedBy = UserRepository.GetCurrentUserInfo().UserID;

                        SourceRepository.Update(info);
                    }
                    break;

                case "add":
                    info = new SourceInfo
                    {
                        Name        = form.Get("Name"),
                        Code        = form.Get("Code"),
                        Description = form.Get("Description"),
                        CreatedBy   = UserRepository.GetCurrentUserInfo().UserID
                    };


                    SourceRepository.Create(info);
                    break;

                case "del":
                    SourceRepository.Delete(id, UserRepository.GetCurrentUserInfo().UserID);
                    break;

                default:
                    break;
                }
            }
            return(retVal);
        }
コード例 #4
0
 public ActionResult Delete(int id)
 {
     _rep.Delete(id);
     return(RedirectToAction("Index"));
 }