コード例 #1
0
        public IHttpActionResult Putauthors2(int id, Authors2 authors2)
        {
            if (id != authors2.au_id)
            {
                return(BadRequest());
            }

            try
            {
                bs.Updated(authors2);
            }
            catch (Exception ee)
            {
                if (!AuthorsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
 public override string ToString()
 {
     if (SourceType == SourceType.WebSite)
     {
         var result = new StringBuilder();
         result.Append(Site).Append(" ").Append(ElectronicSourceText);
         if (PublisherCity != null || PublisherYear != null)
         {
             result.Append(". – ");
             if (PublisherCity != null)
             {
                 result.Append(PublisherCity);
                 if (PublisherYear != null)
                 {
                     result.Append(", ");
                 }
             }
             if (PublisherYear != null)
             {
                 result.Append(PublisherYear);
             }
         }
         result.Append(". – ").Append(ModeOfAccess);
         result.Append(". – ").Append(DateOfAccess);
         result.Append(".");
         return(result.ToString());
     }
     else
     {
         var result = new StringBuilder();
         if (Authors1.Any())
         {
             result.Append(Authors1.First().ToString("r")).Append(" ");
         }
         result.Append(Title);
         if (Authors2.Any())
         {
             result.Append(" / ").Append(string.Join(", ", Authors2));
         }
         result.Append(" // ").Append(Site).Append(" ").Append(ElectronicSourceText);
         if (PublisherYear != null)
         {
             result.Append(". – ").Append(PublisherYear);
         }
         if (No != null)
         {
             result.Append(". – ").Append(No);
         }
         result.Append(". – ").Append(ModeOfAccess);
         result.Append(". – ").Append(DateOfAccess);
         result.Append(".");
         return(result.ToString());
     }
 }
コード例 #3
0
        public IHttpActionResult Getauthors2(int id)
        {
            Authors2 employees = bs.GetOneById(id);

            if (employees == null)
            {
                return(NotFound());
            }

            return(Ok(employees));
        }
コード例 #4
0
        public IHttpActionResult Postauthors2(Authors2 authors2)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            bs.Insert(authors2);
            Authors2 newEmp = bs.SearchByFirstName(authors2.au_fname).LastOrDefault();

            return(CreatedAtRoute("DefaultApi", new { id = newEmp.au_id }, newEmp));
        }
コード例 #5
0
            public override string ToString()
            {
                var result = new StringBuilder();

                if (Authors1.Any())
                {
                    result.Append(Authors1.First().ToString("r")).Append(" ");
                }
                result.Append(Title).Append(" / ");
                result.Append(string.Join(", ", Authors2));
                if (HasOtherAuthors)
                {
                    result.Append(Lang == "by" ? " [і інш.]" : " [и др.]");                  // TODO.
                }
                if (Collectivity != null)
                {
                    result.Append(Collectivity);
                }

                if (Editor != null)
                {
                    if (Collectivity != null || Authors2.Any())
                    {
                        result.Append(" ; ");
                    }

                    result.Append(EditorText).Append(" ").Append(Editor);
                    if (EditorTitle != null)
                    {
                        result.Append(" (").Append(EditorTitle).Append(")");
                    }
                    if (HasOtherEditors)
                    {
                        result.Append(Lang == "by"? " [і інш.]" : " [и др.]");
                    }
                }
                if (Edition != null)
                {
                    result.Append(". – ").Append(Edition).Append("-е ").Append(Lang == "by"? "выд." : "изд.");
                }
                result.Append(". – ").Append(PublisherCity).Append(" : ").Append(PublisherName).Append(", ").Append(PublisherYear);
                if (PublisherYearEnd != null)
                {
                    result.Append("–").Append(PublisherYearEnd);
                }

                if (Pages != null)
                {
                    result.Append(". – ").Append(Pages).Append(" с.");
                }
                return(result.Replace("..", ".").ToString());
            }
コード例 #6
0
 protected bool Equals(Book other) =>
 (Authors1?.SequenceEqual(other.Authors1) ?? true) &&
 string.Equals(Title, other.Title) &&
 (Authors2?.SequenceEqual(other.Authors2) ?? true) &&
 HasOtherAuthors == other.HasOtherAuthors &&
 Collectivity == other.Collectivity &&
 Equals(Editor, other.Editor) &&
 HasOtherEditors == other.HasOtherEditors &&
 string.Equals(EditorText, other.EditorText) &&
 Edition == other.Edition &&
 string.Equals(PublisherCity, other.PublisherCity) &&
 string.Equals(PublisherName, other.PublisherName) &&
 PublisherYear == other.PublisherYear &&
 Pages == other.Pages &&
 PageStart == other.PageStart &&
 PageEnd == other.PageEnd &&
 Number == other.Number &&
 Volume == other.Volume &&
 PublisherYearEnd == other.PublisherYearEnd;
コード例 #7
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (Authors1 != null? Authors1.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Title != null? Title.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Authors2 != null? Authors2.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ HasOtherAuthors.GetHashCode();
         hashCode = (hashCode * 397) ^ (Editor != null? Editor.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ HasOtherEditors.GetHashCode();
         hashCode = (hashCode * 397) ^ Edition.GetHashCode();
         hashCode = (hashCode * 397) ^ (PublisherCity != null? PublisherCity.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (PublisherName != null? PublisherName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ PublisherYear.GetHashCode();
         hashCode = (hashCode * 397) ^ Pages.GetHashCode();
         hashCode = (hashCode * 397) ^ PageStart.GetHashCode();
         hashCode = (hashCode * 397) ^ PageEnd.GetHashCode();
         hashCode = (hashCode * 397) ^ Number.GetHashCode();
         return(hashCode);
     }
 }