public override bool Delete <T>(T toDelete)
        {
            bool result = SourceRepository.Delete(toDelete);

            DeleteFromWriteRepos <T>(toDelete);
            return(result);
        }
 // удаляет источник
 private void DeleteSource()
 {
     if (SelectedSource == null)
     {
         return;
     }
     Messager.ShowAskToDeleteMessage(SelectedSource.Name, delegate()
     {
         SourceRepository.Delete(SelectedSource);
         ChangeSourceList(SelectedSource.Type);
     });
 }
Example #3
0
        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);
        }
Example #4
0
 public ActionResult Delete(int id)
 {
     _rep.Delete(id);
     return(RedirectToAction("Index"));
 }