示例#1
0
 public async Task <bool> UpdateAsync(CelebrityCard Card)
 {
     return(await Task.Factory.StartNew(() =>
     {
         return this.Update(Card);
     }));
 }
示例#2
0
        public bool Create(CelebrityCard Card)
        {
            var cards        = this.Get();
            var originalSize = cards.Count;

            cards.Add(Card);
            var changes = this.Save(cards);

            return(changes != originalSize);
        }
示例#3
0
 public async Task <HttpResponseMessage> Update([FromBody] CelebrityCard card)
 {
     try
     {
         return(Request.CreateResponse(HttpStatusCode.OK, await new CelebritiesBLL().UpdateAsync(card)));
     }
     catch (Exception ex)
     {
         return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
     }
 }
示例#4
0
 public async Task <HttpResponseMessage> Create([FromBody] CelebrityCard card)
 {
     try
     {
         var response = Request.CreateResponse(HttpStatusCode.OK, await new CelebritiesBLL().CreateAsync(card));
         response.Headers.Add("Created_Id", card.Id);
         return(response);
     }
     catch (Exception ex)
     {
         return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
     }
 }
示例#5
0
        public bool Update(CelebrityCard Card)
        {
            var cards = this.Get();
            var index = cards.FindIndex(x => x.Id == Card.Id);

            if (index == -1)
            {
                return(false);
            }

            cards[index] = Card;
            var changes = this.Save(cards);

            return(true);
        }
示例#6
0
 public bool Update(CelebrityCard Card)
 {
     return(this.DAL.Update(Card));
 }
示例#7
0
 public bool Create(CelebrityCard Card)
 {
     return(this.DAL.Create(Card));
 }