public bool AddLanguage(AddLanguageRequest request) { if (request != null) { Languages language = new Languages(); language.LanguageNames = request.LanguageName; _db.LanguagesTable.Add(language); _db.SaveChanges(); return(true); } return(false); }
public IHttpActionResult AddLanguage(AddLanguageRequest request) { request.ValidateNotNull(); LanguageDomain languageDomain = new LanguageDomain() { Name = request.Name, IsoCode = request.IsoCode, IsActive = request.IsActive, IsDefault = request.IsDefault }; return(Ok(new AddLanguageResponse() { Data = _languageManipulation.AddLanguage(languageDomain), Success = Common.Enumerations.ResponseStatus.Succeeded })); }
public bool AddLanguages(AddLanguageRequest request) { if (request != null) { List <Language> languages; //to check if the language is already exist languages = _db.Languages.Where(a => a.LanguageName.ToLower() == request.name.ToLower()).ToList(); //If language not exist add to database if (languages.Count == 0) { Language language = new Language(); language.LanguageName = request.name; _db.Languages.Add(language); _db.SaveChanges(); return(true); } //if language exist return false return(false); } return(false); }
public IActionResult AddLanguage(AddLanguageRequest data) { return(Ok(repository.AddLanguages(data))); }