Example #1
0
        // POST api/issues

        /// <summary>
        ///     Adds a new issue.
        /// </summary>
        /// <param name="value">Issue.</param>
        /// <returns>Issue.</returns>
        public Issue Post(Issue value)
        {
            value.Created = DateTime.UtcNow;
            value.Modified = DateTime.UtcNow;
            value.Id = DateTime.UtcNow.Ticks.ToString(CultureInfo.InvariantCulture);

            return _issues.Add(value);
        }
Example #2
0
        // PUT api/issues/5

        /// <summary>
        ///     Updates an issue.
        /// </summary>
        /// <param name="value">Issue.</param>
        /// <returns>Issue.</returns>
        public async Task<Issue> Put(Issue value)
        {
            Issue issue = await _issues.SingleOrDefaultAsync(p => p.Id == value.Id);
            if (issue == null)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }

            return await _issues.UpdateAsync(value);
        }