Exemplo n.º 1
0
        public TranslationWord DeleteTranslationWord(TranslationWord translationWord)
        {
            var result = TranslationWordRepository.Remove(translationWord);

            Context.SaveChanges();
            return(result);
        }
Exemplo n.º 2
0
        public TranslationWord UpdateTranslationWork(TranslationWord translationWord)
        {
            var result = TranslationWordRepository.Update(translationWord);

            Context.SaveChanges();
            return(result);
        }
Exemplo n.º 3
0
        public TranslationWord AddTranslationWord(TranslationWord translationWord)
        {
            var result = TranslationWordRepository.Add(translationWord);

            Context.SaveChanges();
            return(result);
        }
Exemplo n.º 4
0
        public ActionResult DeleteConfirmed(int id)
        {
            TranslationWord translationWord = UnitOfWork.TranslationManager.GetTranslationWord(id);

            UnitOfWork.TranslationManager.DeleteTranslationWord(translationWord);
            return(PartialView(new TranslationWordView
            {
                Code = translationWord.Code,
                TranslationWordId = translationWord.TranslationWordId,
                Description = translationWord.Description,
                TranslationLanguageId = translationWord.TranslationLanguageId
            }));
        }
Exemplo n.º 5
0
        public ActionResult Edit([Bind(Include = "TranslationWordId,TranslationLanguageId,Description,Code,IsDeleted")] TranslationWordView instance)
        {
            ViewBag.TranslationLanguageId = new SelectList(UnitOfWork.TranslationManager.GetTranslationLanguages(), "TranslationLanguageId", "Description", instance.TranslationLanguageId);
            TranslationWord translationWord = UnitOfWork.TranslationManager.GetTranslationWord(instance.TranslationWordId);

            if (ModelState.IsValid)
            {
                translationWord.Code = instance.Code;
                translationWord.TranslationWordId     = instance.TranslationWordId;
                translationWord.TranslationLanguageId = instance.TranslationLanguageId;
                translationWord.Description           = instance.Description;
                UnitOfWork.TranslationManager.UpdateTranslationWork(translationWord);
                return(PartialView(instance));
            }
            return(PartialView(instance));
        }
Exemplo n.º 6
0
        public ActionResult Create([Bind(Include = "TranslationWordId,TranslationLanguageId,Description,Code,IsDeleted")] TranslationWordView instance)
        {
            ViewBag.TranslationLanguageId = new SelectList(UnitOfWork.TranslationManager.GetTranslationLanguages(), "TranslationLanguageId", "Description", instance.TranslationLanguageId);
            TranslationWord translationWord = null;

            if (ModelState.IsValid)
            {
                translationWord = new TranslationWord
                {
                    Code                  = instance.Code,
                    Description           = instance.Description,
                    IsDeleted             = false,
                    TranslationLanguageId = instance.TranslationLanguageId
                };
                UnitOfWork.TranslationManager.AddTranslationWord(translationWord);
                return(PartialView(instance));
            }

            return(PartialView(instance));
        }
Exemplo n.º 7
0
        // GET: TranslationWords/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TranslationWord translationWord = UnitOfWork.TranslationManager.GetTranslationWord(id.Value);

            if (translationWord == null)
            {
                return(HttpNotFound());
            }
            return(PartialView(new TranslationWordView
            {
                Code = translationWord.Code,
                Description = translationWord.Description,
                TranslationLanguageId = translationWord.TranslationLanguageId,
                TranslationWordId = translationWord.TranslationWordId,
                LanguageCode = translationWord.TranslationLanguage.Code
            }));
        }
Exemplo n.º 8
0
        // GET: TranslationWords/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TranslationWord translationWord = UnitOfWork.TranslationManager.GetTranslationWord(id.Value);

            ViewBag.TranslationLanguageId = new SelectList(UnitOfWork.TranslationManager.GetTranslationLanguages().Where(c => c.TranslationLanguageId == translationWord.TranslationLanguageId), "TranslationLanguageId", "Description");
            if (translationWord == null)
            {
                return(HttpNotFound());
            }
            return(PartialView(new TranslationWordView
            {
                Code = translationWord.Code,
                Description = translationWord.Description,
                TranslationLanguageId = translationWord.TranslationLanguageId,
                TranslationWordId = translationWord.TranslationWordId,
                LanguageCode = translationWord.TranslationLanguage.Code
            }));
        }